Skip to content

Commit fe30f43

Browse files
author
Tim Berners-Lee
committed
A couple of bug fixes, and extract link icon function for general use
1 parent 2aaaee9 commit fe30f43

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

lib/acl-control.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
143143
var ns = UI.ns
144144
var obj = $rdf.sym(uri)
145145
var types = kb.findTypeURIs(obj)
146-
console.log('Drop object types: ' + types)
146+
for (ty in types) {
147+
console.log(' drop object type includes: ' + ty)
148+
}
147149
if (uri.split('/').length === 4 && !(uri.split('/')[1]) && !(uri.split('/')[3])) {
148150
return {pred: 'origin', obj: obj} // The only way to know an origin alas
149151
}
150152
if (ns.vcard('WebID').uri in types) return {pred: 'agent', obj: obj}
151-
153+
152154
if (ns.vcard('Group').uri in types) {
153155
return {pred: 'agentGroup', obj: obj} // @@ note vcard membership not RDFs
154156
}
@@ -167,6 +169,7 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
167169
if (ns.solid('AppProviderClass').uri in types) {
168170
return {pred: 'originClass', obj: obj}
169171
}
172+
console.log(' Triage fails for ' + uri)
170173
}
171174

172175
box.saveBack = function (callback) {
@@ -306,7 +309,6 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
306309
console.log('Drop event. dropEffect: ' + e.dataTransfer.dropEffect)
307310
console.log('Drop event. types: ' + (e.dataTransfer.types ? e.dataTransfer.types.join(', ') : 'NOPE'))
308311

309-
/** THIS IS THE MAGIC: we read from getData based on the content type - so it grabs the item matching that format **/
310312
var uris = null
311313
var text
312314
var thisEle = this
@@ -354,7 +356,7 @@ UI.aclControl.ACLControlBox5 = function (subject, dom, noun, kb, callback) {
354356
if (!ok) {
355357
console.log('Error looking up dropped thing ' + u + ': ' + mess)
356358
} else {
357-
var res = agentTriage(u)
359+
res = agentTriage(u)
358360
if (!res) {
359361
console.log('Error: Drop fails to drop appropriate thing! ' + u)
360362
} else {

lib/widgets.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,19 @@ UI.widgets.makeDraggable = function(tr, obj){
245245
}, false)
246246
}
247247

248+
249+
// A little link icon
250+
//
251+
//
252+
UI.widgets.linkIcon = function(dom, subject, iconURI){
253+
var anchor = dom.createElement('a')
254+
anchor.setAttribute('href', subject.uri)
255+
var linkIcon = anchor.appendChild(dom.createElement('img'))
256+
linkIcon.setAttribute('src', iconURI || (UI.icons.originalIconBase + 'go-to-this.png'))
257+
linkIcon.setAttribute('style','margin: 0.3em;')
258+
return anchor
259+
}
260+
248261
// A TR to repreent a draggable person, etc in a list
249262
//
250263
//
@@ -269,11 +282,8 @@ UI.widgets.personTR = function (dom, pred, obj, options) {
269282
UI.widgets.deleteButtonWithCheck(dom, td3, 'person', options.deleteFunction)
270283
}
271284
if (options.link !== false) {
272-
var anchor = td3.appendChild(dom.createElement('a'))
273-
anchor.setAttribute('href', obj.uri)
285+
var anchor = td3.appendChild(UI.widgets.linkIcon(dom, obj))
274286
anchor.classList.add('HoverControlHide')
275-
var linkImage = anchor.appendChild(dom.createElement('img'))
276-
linkImage.setAttribute('src', UI.icons.originalIconBase + 'go-to-this.png')
277287
td3.appendChild(dom.createElement('br'))
278288
}
279289
if (options.draggable !== false) { // default is on

0 commit comments

Comments
 (0)