Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
form,
store,
complainIfBad
)
}
}) // end: when store loded
} // renderFormsFor
// Figure out what store
// Which places are editable and have stuff about the subject?
var store = null
// 1. The document URI of the subject itself
var docuri = $rdf.Util.uri.docpart(subject.uri)
if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {
store = subject.doc()
} // an editable data file with hash
store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'))
// 2. where stuff is already stored
if (!store) {
var docs = {}
var docList = []
store.statementsMatching(subject).map(function (st) {
docs[st.why.uri] = 1
})
store
.statementsMatching(undefined, undefined, subject)
.map(function (st) {
}
var complainIfBad = function (ok, body) {
if (ok) {
// setModifiedDate(store, kb, store);
// rerender(box); // Deleted forms at the moment
} else complain('Sorry, failed to save your change:\n' + body)
}
// //////////////////////////////////////////////////////////////////////////////
var t = kb.findTypeURIs(subject)
var store = null
if (subject.uri) {
var docuri = $rdf.Util.uri.docpart(subject.uri)
if (subject.uri !== docuri && kb.updater.editable(docuri)) {
store = kb.sym($rdf.Util.uri.docpart(subject.uri))
} // an editable ontology with hash
}
if (!store) store = kb.any(kb.sym(docuri), ns.link('annotationStore'))
if (!store) store = UI.widgets.defaultAnnotationStore(subject)
if (!store) {
store = kb.sym(
'https://formsregistry.solid.community/public/formRegistry/'
) // fallback
}
// if (!store) store = kb.sym('http://tabulator.org/wiki/ontologyAnnotation/common') // fallback
// A fallback which gives a different store page for each ontology would be good @@
var complainIfBad = function (ok, body) {
if (ok) {
// setModifiedDate(store, kb, store);
// rerender(box); // Deleted forms at the moment
} else complain('Sorry, failed to save your change:\n' + body)
}
// //////////////////////////////////////////////////////////////////////////////
var t = kb.findTypeURIs(subject)
var store = null
if (subject.uri) {
var docuri = $rdf.Util.uri.docpart(subject.uri)
if (subject.uri !== docuri && kb.updater.editable(docuri)) {
store = kb.sym($rdf.Util.uri.docpart(subject.uri))
} // an editable ontology with hash
}
if (!store) store = kb.any(kb.sym(docuri), ns.link('annotationStore'))
if (!store) store = UI.widgets.defaultAnnotationStore(subject)
if (!store) {
store = kb.sym(
'https://formsregistry.solid.community/public/formRegistry/'
) // fallback
}
// if (!store) store = kb.sym('http://tabulator.org/wiki/ontologyAnnotation/common') // fallback
// A fallback which gives a different store page for each ontology would be good @@
var pred
if (t[ns.rdfs('Class').uri]) {
if (returnCode === returnConditions[i](subject)) {
render()
UI.log.debug('outline 1815')
if (returnCode[1]) outlineElement.removeChild(outlineElement.lastChild)
return
}
}
if (
subject.uri &&
!immediate &&
!UI.widgets.isAudio(subject) &&
!UI.widgets.isVideo(subject) && // Never parse videos as data
!kb.holds(
subject,
UI.ns.rdf('type'),
$rdf.Util.mediaTypeClass('application/pdf')
)
) {
// or PDF
// Wait till at least the main URI is loaded before expanding:
sf.nowOrWhenFetched(subject.doc(), undefined, function (ok, body) {
if (ok) {
sf.lookUpThing(subject)
render() // inital open, or else full if re-open
if (options.solo) {
// Update window title with new information
// dom.title = UI.utils.label(subject)
setUrlBarAndTitle(subject)
}
} else {
var message = dom.createElement('pre')
message.textContent = body
kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {
if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)
// Render the forms
var forms = UI.widgets.formsFor(subject)
// complain('Form for editing this form:');
for (var i = 0; i < forms.length; i++) {
var form = forms[i]
var heading = dom.createElement('h4')
box.appendChild(heading)
if (form.uri) {
var formStore = $rdf.Util.uri.document(form)
if (formStore.uri !== form.uri) {
// The form is a hash-type URI
var e = box.appendChild(
UI.widgets.editFormButton(
dom,
box,
form,
formStore,
complainIfBad
)
)
e.setAttribute('style', 'float: right;')
}
}
var anchor = dom.createElement('a')
anchor.setAttribute('href', form.uri)
buttons.isImage = function (file, kind) {
var dcCLasses = {
audio: 'http://purl.org/dc/dcmitype/Sound',
image: 'http://purl.org/dc/dcmitype/Image',
video: 'http://purl.org/dc/dcmitype/MovingImage'
}
var what = kind || 'image'
var typeURIs = UI.store.findTypeURIs(file)
var prefix = $rdf.Util.mediaTypeClass(what + '/*').uri.split('*')[0]
for (var t in typeURIs) {
if (t.startsWith(prefix)) return true
}
if (dcCLasses[what] in typeURIs) return true
return false
}
label: function (subject, context) {
var kb = context.session.store
var typeURIs = kb.findTypeURIs(subject)
var prefix = $rdf.Util.mediaTypeClass('audio/*').uri.split('*')[0]
for (var t in typeURIs) {
if (t.startsWith(prefix)) return 'Play audio'
}
return null
},
label: function (subject, context) {
var kb = context.session.store
var typeURIs = kb.findTypeURIs(subject)
var prefix = $rdf.Util.mediaTypeClass('video/*').uri.split('*')[0]
for (var t in typeURIs) {
if (t.startsWith(prefix)) return 'Play video'
}
return null
},
var hasContentTypeIn2 = function (kb, x, displayables) {
var t = kb.findTypeURIs(subject)
for (var k = 0; k < displayables.length; k++) {
if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {
return true
}
}
return false
}
var hasContentTypeIn2 = function (kb, x, displayables) {
var t = kb.findTypeURIs(subject)
for (var k = 0; k < displayables.length; k++) {
if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {
return true
}
}
return false
}