diff --git a/src/lib/utils_export.js b/src/lib/utils_export.js index 967314c6..0279c416 100644 --- a/src/lib/utils_export.js +++ b/src/lib/utils_export.js @@ -186,8 +186,8 @@ const utilsExport = { */ createLiteral: function(property,userValue){ let p = this.createElByBestNS(property) - - + + // it should be stored under the same key if (userValue[property] && property != "http://id.loc.gov/ontologies/bibframe/electronicLocator"){ // without this exception, an edit to an incoming URL in SupplementaryContentNote's "Electronic Location" will update the "rdf:resource" @@ -203,7 +203,7 @@ const utilsExport = { if (userValue['@id']){ p.setAttributeNS(this.namespace.rdf, 'rdf:resource', userValue['@id']) } - + if (!this.checkForEDTFDatatype){ this.checkForEDTFDatatype = useConfigStore().checkForEDTFDatatype} if (userValue['@datatype']){ @@ -449,7 +449,7 @@ const utilsExport = { let orginalProfile = profile // cut the ref to the orginal profile = JSON.parse(JSON.stringify(profile)) - + let xmlParser = returnDOMParser() // these will store the top level elements @@ -561,7 +561,7 @@ const utilsExport = { let userValue // the uservalue could be stored in a few places depending on the nesting - if (ptObj.userValue[ptObj.propertyURI] && ptObj.userValue[ptObj.propertyURI][0]){ + if (ptObj.userValue[ptObj.propertyURI] && ptObj.userValue[ptObj.propertyURI][0]){ userValue = ptObj.userValue[ptObj.propertyURI][0] // it might be a top level literal, if so we don't want to exclude additonal literals that might be added // so look to see if the node we got only has a guid and literal value, and if so look if there are more of them as siblings @@ -577,9 +577,9 @@ const utilsExport = { userValue = ptObj.userValue[ptObj.propertyURI] // console.log("SETTING userValue to the group!",userValue) } - } + } } - + }else if (ptObj.userValue[ptObj.propertyURI]){ userValue = ptObj.userValue[ptObj.propertyURI] }else{ @@ -594,8 +594,8 @@ const utilsExport = { } let mostCommonScript = useProfileStore().setMostCommonNonLatinScript() - - // in bf->marc conversion it builds 880s and 600s based off of the presenece of + + // in bf->marc conversion it builds 880s and 600s based off of the presenece of // multiple auth labels one with no @lang tag and ones that do have it // check specific properties for now? (10/2024) if ([ @@ -605,9 +605,9 @@ const utilsExport = { ].indexOf(ptObj.propertyURI)>-1){ - // recusrive function to go through each key in the userValue and keep going till we find labels or marckeys + // recusrive function to go through each key in the userValue and keep going till we find labels or marckeys // the two properties that make 880s work - let process = function(obj, func) { + let process = function(obj, func) { if (Array.isArray(obj)){ obj.forEach(function (child) { process(child, func); @@ -623,7 +623,7 @@ const utilsExport = { } } } - } + } } process(ptObj.userValue, function (property,ary) { @@ -639,7 +639,7 @@ const utilsExport = { } // if we have a language then great, also check the manual setting if (profile.nonLatinScriptAgents){ - if (profile.nonLatinScriptAgents[ptObj['@guid']]){ + if (profile.nonLatinScriptAgents[ptObj['@guid']]){ keepLang = [profile.nonLatinScriptAgents[ptObj['@guid']]] } } @@ -648,16 +648,16 @@ const utilsExport = { } let toRemove = [] - for (var i = 0; i < ary.length; i++) { + for (var i = 0; i < ary.length; i++) { let value = ary[i] // no lang tag? good, thats the authorized latin script one - if (!value['@language']){ + if (!value['@language']){ continue }else{ // it has a language tag? is it one of the ones we want to keep? let keepIt = false for (let l of keepLang){ - + if (value['@language'].toLowerCase().indexOf('-' + l.toLowerCase()) >-1){ keepIt = true } @@ -677,7 +677,7 @@ const utilsExport = { // there isn't a non-latin script in the record, so remove all the non-latin properties let toRemove = [] - for (var i = 0; i < ary.length; i++) { + for (var i = 0; i < ary.length; i++) { let value = ary[i] if (value['@language']){ toRemove.push(value['@language']) @@ -695,7 +695,7 @@ const utilsExport = { xmlLog.push(['Set userValue to:', JSON.parse(JSON.stringify(userValue)) ]) - + if (this.ignoreProperties.indexOf(ptObj.propertyURI) > -1){ xmlLog.push(`Skpping it because it is in the ignoreProperties list`) continue @@ -754,9 +754,9 @@ const utilsExport = { xmlLog.push(`Root level bnode: ${ptObj.propertyURI}`) let pLvl1 = this.createElByBestNS(ptObj.propertyURI) - + let bnodeLvl1 = this.createBnode(userValue, ptObj.propertyURI) - + xmlLog.push(`Created lvl 1 predicate: ${pLvl1.tagName} and bnode: ${bnodeLvl1.tagName}`) // loop though the properties @@ -776,7 +776,7 @@ const utilsExport = { if (userValue[key1] && userValue[key1][0] && userValue[key1][0]['@id']){ let rdftype = this.createElByBestNS(key1) rdftype.setAttributeNS(this.namespace.rdf, 'rdf:resource', userValue[key1][0]['@id']) - + bnodeLvl1.appendChild(rdftype) xmlLog.push(`This bnode just has a rdf:type : ${rdftype} setting it an continuing`) continue @@ -784,7 +784,7 @@ const utilsExport = { let rdftype = this.createElByBestNS(key1) rdftype.innerHTML=escapeHTML(userValue[key1][0]['http://www.w3.org/2000/01/rdf-schema#label'][0]['http://www.w3.org/2000/01/rdf-schema#label']) xmlLog.push(`This bnode just has a rdf:type and label : ${rdftype} setting it an continuing`) - + bnodeLvl1.appendChild(rdftype) continue } @@ -806,7 +806,7 @@ const utilsExport = { if (this.isBnode(value1)){ // yes let bnodeLvl2 = this.createBnode(value1,key1) - + pLvl2.appendChild(bnodeLvl2) bnodeLvl1.appendChild(pLvl2) xmlLog.push(`Creating bnode lvl 2 for it ${bnodeLvl2.tagName}`) @@ -816,7 +816,7 @@ const utilsExport = { let pLvl3 = this.createElByBestNS(key2) xmlLog.push(`Creating lvl 3 property: ${pLvl3.tagName} for ${key2}`) - + for (let value2 of value1[key2]){ if (this.isBnode(value2)){ // more nested bnode @@ -909,7 +909,7 @@ const utilsExport = { bnodeLvl1.setAttributeNS(this.namespace.rdf, 'rdf:about', value1['@id']) } } - + if (keys.length>0){ for (let key2 of keys){ if (typeof value1[key2] == 'string' || typeof value1[key2] == 'number'){ @@ -985,7 +985,7 @@ const utilsExport = { if (!Array.isArray(userValue)){ userValueArray = [userValue] } - + // but it might be a bnode, but with only a URI for (let userValue of userValueArray){ @@ -1153,7 +1153,7 @@ const utilsExport = { xmlLog.push(`Skpping it because hasUserValue == false`) } } - + // add in the admindata // if (orginalProfile.rt[rt].adminMetadataData){ @@ -1237,10 +1237,17 @@ const utilsExport = { // Add in a adminMetadata to the resources with this user id - // console.log(profile) - let catCode = profile.user.split(" (") - catCode = catCode[catCode.length-1] - catCode=catCode.split(")")[0] + // catInitals.log(profile) + //get user info from preferenceStore instead of the profile + let userInitial = usePreferenceStore().catInitals + let catCode = usePreferenceStore().catCode + let user = `${userInitial} (${catCode})` + profile.user = user + // console.info("userInitial: ", userInitial) + // console.info("userCode: ", userCode) + // let catCode = profile.user.split(" (") + // catCode = catCode[catCode.length-1] + // catCode=catCode.split(")")[0] let bf_adminMetadata = this.createElByBestNS("bf:adminMetadata") let bf_AdminMetadtat = this.createElByBestNS("bf:AdminMetadata") @@ -1612,10 +1619,10 @@ const utilsExport = { // console.log(strXmlFormatted) // console.log("------") // console.log(strXmlBasic) - + // let newXML = this.splitComplexSubjects(strBf2MarcXmlElBib) // strBf2MarcXmlElBib = (new XMLSerializer()).serializeToString(newXML) - + return { xmlDom: rdf, xmlStringFormatted: strXmlFormatted, @@ -1627,7 +1634,7 @@ const utilsExport = { componentXmlLookup:componentXmlLookup } }, - + //This was handled in the `add()` of `SubjectEditor.vue`, but there are some situtations where that don't work as intended // namely, complex subjects that have subdivisions // !! This is not being used, incase having the profile in Marva be different from the XML causes issues somewhere @@ -1641,10 +1648,10 @@ const utilsExport = { // subject = parser.parseFromString(subject.innerHTML, "application/xml") let componentList = subject.getElementsByTagName("madsrdf:componentList") - + if (componentList.length > 0){ const clone = componentList[0].cloneNode(true) - + let labels = [] let marcKeys = [] @@ -1655,23 +1662,23 @@ const utilsExport = { clone.getElementsByTagName("bflc:marcKey").forEach((key) => { marcKeys.push(key.innerHTML) }) - + for (let label in labels){ //save the element incase it needs to be re-added const frozenElement = componentList[0].children[0] //clone.children[label] - + //remove the existing element componentList[0].children[0].remove() - + if (labels[label].includes("--") && !marcKeys[label].includes("$z") ){ - + let newElements = [] let marcKey = marcKeys[label] let tag = marcKey.slice(0, 3) let subfields = marcKey.slice(5) subfields = subfields.match(/\$[axyzv]{1}/g) - + let terms = labels[label].split("--") //Determine the tag for the new element for (let term in terms){ @@ -1715,27 +1722,27 @@ const utilsExport = { //Add the auth label let authLabelElement = document.createElementNS("http://www.loc.gov/mads/rdf/v1#", "madsrdf:authoritativeLabel") authLabelElement.innerHTML = terms[term] - + //Add the marcKey let marcKeyElement = document.createElementNS("http://id.loc.gov/ontologies/bflc/", "bflc:marcKey") marcKeyElement.innerHTML = tag + " " + subfields[term] + terms[term] - + typeElement.appendChild(authLabelElement) typeElement.appendChild(marcKeyElement) - + componentList[0].appendChild(typeElement) } } else { //it's a term that doesn't need to be split, be we'll re-add it to ensure the pieces are in the correct order - + componentList[0].appendChild(frozenElement) - + } } } - + } - + return xml }, @@ -1750,7 +1757,7 @@ const utilsExport = { */ createHubStubXML: async function(hubCreatorObj,title,langUri){ - + console.log(hubCreatorObj,title,langUri) @@ -1778,7 +1785,7 @@ const utilsExport = { // da hub let elHub = document.createElementNS(this.namespace.bf ,'bf:Hub') - + // uri elHub.setAttributeNS(this.namespace.rdf, 'rdf:about', hubUri) let elTitleProperty = document.createElementNS(this.namespace.bf ,'bf:title') @@ -1823,8 +1830,8 @@ const utilsExport = { elContributionClass.appendChild(elAgentProperty) elHub.appendChild(elContributionProperty) - - + + rdf.appendChild(elHub) @@ -1843,7 +1850,7 @@ const utilsExport = { // // // 440 0$aFilosofia e scienza nell'età moderna.$n1,$pStudi ;$v68 - // + // {/* @@ -1867,7 +1874,7 @@ const utilsExport = { - + console.log(aap) console.log(aapHash) console.log(hubUri) diff --git a/src/lib/utils_network.js b/src/lib/utils_network.js index 8b0e0c33..bd25e7e1 100644 --- a/src/lib/utils_network.js +++ b/src/lib/utils_network.js @@ -2793,7 +2793,6 @@ const utilsNetwork = { } - let ourVer = useConfigStore().versionMajor + (useConfigStore().versionMinor * 0.1) + (useConfigStore().versionPatch* 0.01) let curVer = content.major + (content.minor* 0.1) + (content.patch* 0.01) console.log("ourVer:",ourVer,"curVer:",curVer) diff --git a/src/stores/config.js b/src/stores/config.js index bc399016..313601a1 100644 --- a/src/stores/config.js +++ b/src/stores/config.js @@ -7,7 +7,7 @@ export const useConfigStore = defineStore('config', { versionMajor: 0, versionMinor: 16, - versionPatch: 22, + versionPatch: 23, regionUrls: {