From b45d4dcd34a991a861e4618b45943563167a0ea8 Mon Sep 17 00:00:00 2001 From: Tim Berners-Lee Date: Sun, 18 Nov 2012 12:22:11 -0500 Subject: [PATCH] Attach pane basically works, right hand panel (view attached thing) is a bit of a kludge. Re-added the image pane, as the atach pane uses it. --- js/init/panes.js | 8 +++- js/panes/attach/attachPane.js | 90 +++++++++++++++++++++++++++++------ js/panes/dataContentPane.js | 15 +++++- js/panes/paneUtils.js | 2 +- js/tab/outline.js | 16 ++++--- 5 files changed, 106 insertions(+), 25 deletions(-) diff --git a/js/init/panes.js b/js/init/panes.js index dfe6c11..a81c74b 100644 --- a/js/init/panes.js +++ b/js/init/panes.js @@ -46,8 +46,13 @@ tabulator.loadScript("js/panes/paneUtils.js"); tabulator.loadScript("js/panes/issue/pane.js"); tabulator.loadScript("js/panes/transaction/pane.js"); tabulator.loadScript("js/panes/trip/tripPane.js"); -tabulator.loadScript("js/panes/dataContentPane.js"); tabulator.loadScript("js/panes/airPane.js"); + +// Content views + +tabulator.loadScript("js/panes/imagePane.js"); // Basic image view + +tabulator.loadScript("js/panes/dataContentPane.js"); // Prefered tabulator.loadScript("js/panes/n3Pane.js"); tabulator.loadScript("js/panes/RDFXMLPane.js"); @@ -74,7 +79,6 @@ tabulator.loadScript("js/panes/pubsPane.js"); tabulator.loadScript("js/panes/microblogPane/microblogPane.js"); -// tabulator.loadScript("js/panes/imagePane.js"); tabulator.loadScript("js/panes/socialPane.js"); //tabulator.loadScript("js/panes/social/pane.js"); diff --git a/js/panes/attach/attachPane.js b/js/panes/attach/attachPane.js index ec07d1b..ca53fd1 100644 --- a/js/panes/attach/attachPane.js +++ b/js/panes/attach/attachPane.js @@ -25,13 +25,22 @@ tabulator.panes.register( { name: 'attachments', // Does the subject deserve an issue pane? + // + // In this case we will render any thing which is in any subclass of + // certain classes, or also the certain classes themselves, as a + // triage tool for correlating many attachees with attachments. + // We also offer the pane for anything of any class which just has an attachment already. + // label: function(subject) { var kb = tabulator.kb; var t = kb.findTypeURIs(subject); - if (t['http://www.w3.org/ns/pim/trip#Trip'] || + var WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#'); + if (t['http://www.w3.org/ns/pim/trip#Trip'] || // If in any subclass subject.uri == 'http://www.w3.org/ns/pim/trip#Trip' || + t['http://www.w3.org/2005/01/wf/flow#Task'] || t['http://www.w3.org/2000/10/swap/pim/qif#Transaction'] || - subject.uri == 'http://www.w3.org/2000/10/swap/pim/qif#Transaction') return "attachments"; + subject.uri == 'http://www.w3.org/2000/10/swap/pim/qif#Transaction' || + kb.holds(subject, WF('attachment'))) return "attachments"; return null; }, @@ -71,16 +80,14 @@ tabulator.panes.register( { // Where can we write about this thing? // - // Returns term for document of null + // Returns term for document or null var findStore = function(kb, subject) { var docURI = tabulator.rdf.Util.uri.docpart(subject.uri); if (tabulator.sparql.editable(docURI, kb)) return kb.sym(docURI); var store = kb.any(kb.sym(docURI), QU('annotationStore')); + // if (!store) complain("No store for "+docURI); return store; } - - - var div = dom.createElement("div"); @@ -104,7 +111,10 @@ tabulator.panes.register( { // var getMembersAndSort = function(subject) { - var sortBy = { 'http://www.w3.org/ns/pim/trip#Trip' : // @@ put this into the ontologies + var sortBy = { + 'http://www.w3.org/2005/01/wf/flow#Task' : + 'http://purl.org/dc/elements/1.1/created', + 'http://www.w3.org/ns/pim/trip#Trip' : // @@ put this into the ontologies 'http://www.w3.org/2002/12/cal/ical#dtstart' , 'http://www.w3.org/2000/10/swap/pim/qif#Transaction' : 'http://www.w3.org/2000/10/swap/pim/qif#date', @@ -249,15 +259,27 @@ tabulator.panes.register( { } currentObject = x; try { - if (x.uri.slice(-4) == ".pdf") { // @@@ KLUDGE! use metadata after HEAD + +/* + var table = dom.createElement('table'); + tabulator.outline.GotoSubject(x, true, undefined, false, undefined, table) +*/ + + if (x.uri.slice(-4) == ".pdf" || x.uri.slice(-4) == ".png" || + x.uri.slice(-5) == ".jpeg") { // @@@ KLUDGE! use metadata after HEAD preview.innerHTML = ''; } else { - preview.innerHTML = ''; - } + preview.innerHTML = ''; + if (x.uri) kb.fetcher.nowOrWhenFetched(x.uri, undefined, function() { + var display = tabulator.outline.propertyTable(x); // ,table, pane + preview.appendChild(display); + }); + }; + + } catch(e) { - preview.innerHTML = '' + "Error:" + ''; + preview.innerHTML = '' + "Error:" + e + ''; // @@ enc } } @@ -309,15 +331,55 @@ tabulator.panes.register( { var objectList = tabulator.panes.utils.selectorPanel(dom, kb, objectType, predicate, true, objects, options, showObject, linkClicked); objectList.setAttribute('style', - 'background-color: #ffe; width: 27.5em; height: 100%; padding: 0em; overflow:scroll;'); //float:left + 'background-color: #ffe; width: 30em; height: 100%; padding: 0em; overflow:scroll;'); //float:left wrapper.appendChild(objectList); //objectList.insertBefore(head, objectList.firstChild); var preview = dom.createElement("div"); - preview.setAttribute('style', 'background-color: black; padding: 0em; margin: 0; height: 100%; overflow:scroll;'); + preview.setAttribute('style', /*background-color: black; */ 'padding: 0em; margin: 0; height: 100%; overflow:scroll;'); div.appendChild(preview); + if (subjects.length > 0 && multi) { + var stores = {}; + for (var k=0; k