Skip to content

Commit

Permalink
Merge branch 'main' into bfp-128-language-lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
f-osorio committed Dec 10, 2024
2 parents 836ef7b + b66ccb7 commit 4a8592f
Show file tree
Hide file tree
Showing 9 changed files with 158 additions and 109 deletions.
7 changes: 6 additions & 1 deletion src/components/panels/edit/fields/helpers/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,19 @@
showBuildHubStub(){
console.log("this.propertyPath",this.propertyPath)
if (!this.propertyPath) return false;
if (this.propertyPath && this.propertyPath.length==0) return false;
let pt = this.profileStore.returnStructureByComponentGuid(this.guid)
if (pt && pt.propertyURI && pt.propertyURI == "http://id.loc.gov/ontologies/bibframe/relation"){
return true
}
if (pt && pt.propertyURI && pt.propertyURI == "http://id.loc.gov/ontologies/bibframe/expressionOf"){
return true
}
return false
Expand Down
49 changes: 41 additions & 8 deletions src/components/panels/edit/modals/HubStubCreateModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
displayModal:false,
postStatus: 'unposted',
newHubUrl: null,
Expand Down Expand Up @@ -155,7 +158,7 @@
console.log(this.hubCreator)
},
Expand All @@ -175,11 +178,22 @@
async buildHub(){
this.postStatus='posting'
let results = await this.profileStore.buildPostHubStub(this.hubCreator,this.hubTitle,this.hubLang,this.preferenceStore.catCode)
if (results && results.postLocation){
results.postLocation = results.postLocation.replace("http://",'https://')
this.profileStore.setValueComplex(this.activeHubStubComponent.guid, null, this.activeHubStubComponent.propertyPath, results.postLocation, this.hubTitle, null, {}, null)
// this.profileStore.setValueComplex(this.guid, null, this.propertyPath, contextValue.uri, contextValue.title, contextValue.typeFull, contextValue.nodeMap, contextValue.marcKey)
this.newHubUrl=results.postLocation
this.postStatus='posted'
}else{
alert("Error posting!")
this.postStatus='error'
}
console.log(results)
Expand All @@ -190,6 +204,14 @@
},
close(){
this.activeHubStubComponent = {}
this.activeHubStubData = {}
this.showHubStubCreateModal=false
this.postStatus=='unposed'
}
Expand Down Expand Up @@ -262,7 +284,7 @@
<div id="non-latin-bulk-content" ref="nonLatinBulkContent" @mousedown="onSelectElement($event)" @touchstart="onSelectElement($event)">

<div class="menu-buttons">
<button class="close-button" @pointerup="showHubStubCreateModal=false">X</button>
<button class="close-button" @pointerup="close">X</button>
</div>
<h3 style="margin-bottom: 1em;">Create Quick Hub</h3>
<div style="display: flex; margin-bottom: 1em;">
Expand All @@ -277,7 +299,7 @@
</template>
</div>


<div style="margin-bottom: 1em;">
<span class="creator-label" v-if="!hubCreator.label">[No Hub Creator]</span>
<span class="creator-label" v-if="hubCreator.label">{{hubCreator.label }}</span>
Expand All @@ -298,15 +320,26 @@
</select>

<hr>
<div>
<div v-if="postStatus!='posted'">
Fill out the above information to create a Hub Stub. You would create a Hub for resources that you would not normally create a MARC Authority record for. Once you click create you will be provided a link to further edit the Hub if you wish.
</div>

<div style="display: flex; padding: 1.5em;">
<div style="display: flex; padding: 1.5em;" v-if="postStatus=='unposted'">
<div style="flex:1; text-align: center;"><button style="line-height: 1.75em;font-weight: bold;font-size: 1.05em;" @click="buildHub">Create Hub</button></div>
<div style="flex:1; text-align: center"><button style="line-height: 1.75em;font-weight: bold;font-size: 1.05em;">Cancel</button></div>
<div style="flex:1; text-align: center"><button @click="close" style="line-height: 1.75em;font-weight: bold;font-size: 1.05em;">Cancel</button></div>
</div>
<div style="display: flex; padding: 1.5em; font-size: 1.5em;" v-if="postStatus=='posting'">
<div >Posting... Please wait...</div>
</div>
<div style="display: flex; padding: 1.5em;" v-if="postStatus=='posted'">
<div >The Hub was created! If you would like to edit it further please click the link, it will open in new tab:</div>
<div><a :href="`../load?url=${newHubUrl}.rdf&profile=lc:RT:bf2:HubBasic:Hub`" target="_blank">{{ newHubUrl }}</a></div>
</div>
<div v-if="postStatus=='posted'" style="text-align: center;">
<button @click="close" style="line-height: 1.75em;font-weight: bold;font-size: 1.05em;">Close</button>

</div>


</div>

Expand Down
2 changes: 1 addition & 1 deletion src/components/panels/sidebar_preview_opac/Opac.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
<svg v-if="profileName.includes(':Item')" viewBox="0 -32 50 72" version="1.1" xmlns="http://www.w3.org/2000/svg">
<rect width="40px" height="40px" class="item-icon" />
</svg>
<svg v-if="profileName.endsWith(':Hub')" version="1.1" viewBox="0 -20 100 100" xmlns="http://www.w3.org/2000/svg">
<svg v-if="profileName.endsWith(':Hub')" version="1.1" viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg">
<path fill="royalblue" d="m62.113 24.66 1.9023-15.238 18.875 32.691-7.5469 20.004 15.238 1.9023-32.691 18.875-20.004-7.5469-1.9023 15.238-18.875-32.691 7.5469-20.004-15.238-1.9023 32.691-18.875zm-17.684 15.695-4.0781 15.215 15.215 4.0781 4.0781-15.215z" fill-rule="evenodd"/>
</svg>
<span class="sidebar-header-text" v-if="profileName.split(':').slice(-1)[0] == 'Work'">{{$t("message.wordWork")}}</span>
Expand Down
76 changes: 5 additions & 71 deletions src/lib/utils_export.js
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ const utilsExport = {


let theHub = (new XMLSerializer()).serializeToString(rdfBasic)
theHub = parser.parseFromString(theHub, "text/xml").children[0];
theHub = xmlParser.parseFromString(theHub, "text/xml").children[0];

rdf = theHub
}
Expand Down Expand Up @@ -1894,12 +1894,12 @@ const utilsExport = {
elAdminAgentCode1.innerHTML='DLC'

let elAdminAgentCode2 = document.createElementNS(this.namespace.rdfs ,'bf:code')
elAdminAgentCode1.setAttributeNS(this.namespace.rdf, 'rdf:datatype', 'http://id.loc.gov/datatypes/orgs/normalized')
elAdminAgentCode1.innerHTML='dlc'
elAdminAgentCode2.setAttributeNS(this.namespace.rdf, 'rdf:datatype', 'http://id.loc.gov/datatypes/orgs/normalized')
elAdminAgentCode2.innerHTML='dlc'

let elAdminAgentCode3 = document.createElementNS(this.namespace.rdfs ,'bf:code')
elAdminAgentCode1.setAttributeNS(this.namespace.rdf, 'rdf:datatype', 'http://id.loc.gov/datatypes/orgs/iso15511')
elAdminAgentCode1.innerHTML='US-dlc'
elAdminAgentCode3.setAttributeNS(this.namespace.rdf, 'rdf:datatype', 'http://id.loc.gov/datatypes/orgs/iso15511')
elAdminAgentCode3.innerHTML='US-dlc'

elAdminAgentClass.appendChild(elAdminAgentCode1)
elAdminAgentClass.appendChild(elAdminAgentCode2)
Expand All @@ -1924,74 +1924,8 @@ const utilsExport = {

elHub.appendChild(elAdminProperty)



// <bf:adminMetadata>
// <bf:AdminMetadata>
// <bf:status>
// <bf:Status rdf:about="http://id.loc.gov/vocabulary/mstatus/n">
// <rdfs:label>new</rdfs:label>
// <bf:code>n</bf:code>
// </bf:Status>
// </bf:status>
// <bf:date rdf:datatype="http://www.w3.org/2001/XMLSchema#date">1996-05-16</bf:date>
// <bf:agent>
// <bf:Agent rdf:about="http://id.loc.gov/vocabulary/organizations/dlc">
// <rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Organization"/>
// <rdfs:label>United States, Library of Congress</rdfs:label>
// <bf:code rdf:datatype="http://id.loc.gov/datatypes/orgs/code">DLC</bf:code>
// <bf:code rdf:datatype="http://id.loc.gov/datatypes/orgs/normalized">dlc</bf:code>
// <bf:code rdf:datatype="http://id.loc.gov/datatypes/orgs/iso15511">US-dlc</bf:code>
// </bf:Agent>
// </bf:agent>
// </bf:AdminMetadata>
// </bf:adminMetadata>



rdf.appendChild(elHub)





// <bf:Hub >
// <bflc:aap >Filosofia e scienza nell'età moderna</bflc:aap>
// <bflc:aap-normalized >filosofiaescienzanell'etàmoderna</bflc:aap-normalized>
// <rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Series" />
// <bf:title >
// <bf:Title >
// <bf:mainTitle >Filosofia e scienza nell'età moderna</bf:mainTitle>
// <bf:partNumber >1</bf:partNumber>
// <bf:partName >Studi</bf:partName>
// </bf:Title>
// </bf:title>
// <bflc:marcKey >440 0$aFilosofia e scienza nell'età moderna.$n1,$pStudi ;$v68</bflc:marcKey>
// </bf:Hub>


{/* <bf:contribution>
<bf:Contribution>
<rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/PrimaryContribution"/>
<bf:agent>
<bf:Agent rdf:about="http://id.loc.gov/rwo/agents/n79021164">
<rdf:type rdf:resource="http://id.loc.gov/ontologies/bibframe/Person"/>
<rdfs:label>Twain, Mark, 1835-1910</rdfs:label>
<bflc:marcKey>1001 $aTwain, Mark,$d1835-1910</bflc:marcKey>
</bf:Agent>
</bf:agent>
<bf:role>
<bf:Role rdf:about="http://id.loc.gov/vocabulary/relators/ctb">
<rdfs:label>contributor</rdfs:label>
<bf:code>ctb</bf:code>
</bf:Role>
</bf:role>
</bf:Contribution>
</bf:contribution> */}




console.log(aap)
console.log(aapHash)
console.log(hubUri)
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils_network.js
Original file line number Diff line number Diff line change
Expand Up @@ -2620,12 +2620,12 @@ const utilsNetwork = {

if (content && content.publish && content.publish.status && content.publish.status == 'published'){

return {status:true}
return {status:true, postLocation: (content.postLocation) ? content.postLocation : null }

}else{

// alert("Did not post, please report this error--" + JSON.stringify(content.publish,null,2))
return {status:false, msg: JSON.stringify(content.publish,null,2)}
return {status:false, postLocation: (content.postLocation) ? content.postLocation : null, msg: JSON.stringify(content.publish,null,2)}
}
},

Expand Down
51 changes: 44 additions & 7 deletions src/lib/utils_parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,26 @@ const utilsParse = {
return xml
},


/**
* For our hub profile we broke out the different title types, sniff for which profile to use
*
* @param {Node} xml - the XML payload
* @return {Node}
*/
sniffTitleType(xml){
for (let child of xml.children){
if (child.tagName == 'bf:title'){
if ( child.innerHTML.indexOf("bf:VariantTitle")>-1){
child.setAttribute('local:pthint', 'lc:RT:bf2:Title:VarTitle')
}if ( child.innerHTML.indexOf("bf:TransliteratedTitle")>-1){
child.setAttribute('local:pthint', 'lc:RT:bflc:TranscribedTitle')
}else{
// leave blank?
}
}
}
return xml
},


specialTransforms: {
Expand Down Expand Up @@ -384,9 +403,12 @@ const utilsParse = {
profile.rtOrder.push(useInstanceRtName + '_'+(i+1))
});

let rtsToRemove = []

for (const pkey in profile.rt) {

let tle = ""
let isHub = false
if (pkey.includes(':Work')){
tle = "bf:Work"
}else if (pkey.includes(':Instance')){
Expand All @@ -395,7 +417,9 @@ const utilsParse = {
tle = "bf:Item"
}else if (pkey.endsWith(':Hub')){
tle = "bf:Hub"
}else{
isHub=true
}else{
rtsToRemove.push(pkey)
// don't mess with anything other than top level entities in the profile, remove them from the profile
continue
}
Expand All @@ -413,12 +437,9 @@ const utilsParse = {

if (xml === false && tle == 'bf:Hub'){
tle = "bf:Work"
isHub=true
console.warn('No bf:Hub found, looking for bf:Work')
if (testRun){
xml = this.testDom.getElementsByTagName(tle)
}else{
xml = this.activeDom.getElementsByTagName(tle)
}
xml = this.activeDom.getElementsByTagName(tle)
xml = this.returnOneWhereParentIs(xml, "rdf:RDF")

}
Expand Down Expand Up @@ -531,6 +552,11 @@ const utilsParse = {
xml = this.sniffNoteType(xml)
}

if (isHub){
xml = this.sniffTitleType(xml)

}



let sucessfulProperties = []
Expand Down Expand Up @@ -1933,6 +1959,17 @@ const utilsParse = {
for (let x of toDeleteNoData){
profile.rt[x].noData=true
}

for (let rt of rtsToRemove){
delete profile.rt[rt]
let index = profile.rtOrder.indexOf(rt);
if (index !== -1) {
profile.rtOrder.splice(index, 1);
}


}

console.log("profileprofileprofileprofile",JSON.parse(JSON.stringify(profile)))

return profile
Expand Down
12 changes: 6 additions & 6 deletions src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const useConfigStore = defineStore('config', {
state: () => ({

versionMajor: 0,
versionMinor: 16,
versionPatch: 29,
versionMinor: 17,
versionPatch: 1,

regionUrls: {

Expand All @@ -25,8 +25,8 @@ export const useConfigStore = defineStore('config', {
profiles : 'http://localhost:9401/util/profiles/profile/prod',
starting: 'http://localhost:9401/util/profiles/starting/prod',

profiles: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/profile-prod/data.json',
// profiles: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/profile-stage/data.json',
// profiles: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/profile-prod/data.json',
profiles: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/profile-stage/data.json',
starting: 'https://raw.githubusercontent.com/lcnetdev/bfe-profiles/main/starting-prod/data.json',


Expand All @@ -50,8 +50,8 @@ export const useConfigStore = defineStore('config', {
shelfListing: 'https://preprod-8230.id.loc.gov/',
// bfdb : 'https://preprod-8210.id.loc.gov/',
bfdb : 'https://preprod-8300.id.loc.gov/',
// profiles : '/bfe2/util/profiles/profile/stage',
profiles : '/bfe2/util/profiles/profile/prod',
profiles : '/bfe2/util/profiles/profile/stage',
// profiles : '/bfe2/util/profiles/profile/prod',
// profiles: 'https://preprod-3001.id.loc.gov/api/listconfigs?where=index.resourceType:profile',
starting : '/bfe2/util/profiles/starting/stage',
id: 'https://preprod-8288.id.loc.gov/',
Expand Down
Loading

0 comments on commit 4a8592f

Please sign in to comment.