solid-panes 3.7.3-3425a37d → 3.7.3-346708d2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/RDFXMLPane.js +58 -0
  2. package/dist/RDFXMLPane.js.map +1 -0
  3. package/dist/argument/argumentPane.js +61 -0
  4. package/dist/argument/argumentPane.js.map +1 -0
  5. package/dist/attach/attachPane.js +394 -0
  6. package/dist/attach/attachPane.js.map +1 -0
  7. package/dist/audio/audioPane.js +182 -0
  8. package/dist/audio/audioPane.js.map +1 -0
  9. package/dist/classInstancePane.js +92 -0
  10. package/dist/classInstancePane.js.map +1 -0
  11. package/dist/dashboard/basicPreferences.js +121 -129
  12. package/dist/dashboard/basicPreferences.js.map +1 -1
  13. package/dist/dashboard/dashboardPane.js +60 -54
  14. package/dist/dashboard/dashboardPane.js.map +1 -1
  15. package/dist/dashboard/homepage.js +45 -54
  16. package/dist/dashboard/homepage.js.map +1 -1
  17. package/dist/dataContentPane.js +259 -0
  18. package/dist/dataContentPane.js.map +1 -0
  19. package/dist/defaultPane.js +75 -0
  20. package/dist/defaultPane.js.map +1 -0
  21. package/dist/dokieli/dokieliPane.js +169 -0
  22. package/dist/dokieli/dokieliPane.js.map +1 -0
  23. package/dist/dokieli/new.js +28 -0
  24. package/dist/dokieli/new.js.map +1 -0
  25. package/dist/form/pane.js +185 -0
  26. package/dist/form/pane.js.map +1 -0
  27. package/dist/global.d.js +2 -0
  28. package/dist/global.d.js.map +1 -0
  29. package/dist/home/homePane.js +60 -55
  30. package/dist/home/homePane.js.map +1 -1
  31. package/dist/humanReadablePane.js +135 -0
  32. package/dist/humanReadablePane.js.map +1 -0
  33. package/dist/imagePane.js +70 -0
  34. package/dist/imagePane.js.map +1 -0
  35. package/dist/index.js +86 -25
  36. package/dist/index.js.map +1 -1
  37. package/dist/internal/internalPane.js +168 -179
  38. package/dist/internal/internalPane.js.map +1 -1
  39. package/dist/mainPage/footer.js +13 -7
  40. package/dist/mainPage/footer.js.map +1 -1
  41. package/dist/mainPage/header.js +59 -58
  42. package/dist/mainPage/header.js.map +1 -1
  43. package/dist/mainPage/index.js +19 -24
  44. package/dist/mainPage/index.js.map +1 -1
  45. package/dist/microblogPane/microblogPane.js +1031 -0
  46. package/dist/microblogPane/microblogPane.js.map +1 -0
  47. package/dist/n3Pane.js +56 -0
  48. package/dist/n3Pane.js.map +1 -0
  49. package/dist/outline/context.js +17 -11
  50. package/dist/outline/context.js.map +1 -1
  51. package/dist/outline/manager.js +1997 -0
  52. package/dist/outline/manager.js.map +1 -0
  53. package/dist/outline/outlineIcons.js +127 -0
  54. package/dist/outline/outlineIcons.js.map +1 -0
  55. package/dist/outline/propertyViews.js +39 -28
  56. package/dist/outline/propertyViews.js.map +1 -1
  57. package/dist/outline/queryByExample.js +285 -0
  58. package/dist/outline/queryByExample.js.map +1 -0
  59. package/dist/outline/userInput.js +1819 -0
  60. package/dist/outline/userInput.js.map +1 -0
  61. package/dist/outline/viewAsImage.js +13 -5
  62. package/dist/outline/viewAsImage.js.map +1 -1
  63. package/dist/outline/viewAsMbox.js +20 -11
  64. package/dist/outline/viewAsMbox.js.map +1 -1
  65. package/dist/pad/padPane.js +395 -404
  66. package/dist/pad/padPane.js.map +1 -1
  67. package/dist/playlist/playlistPane.js +124 -0
  68. package/dist/playlist/playlistPane.js.map +1 -0
  69. package/dist/registerPanes.js +146 -0
  70. package/dist/registerPanes.js.map +1 -0
  71. package/dist/schedule/schedulePane.js +888 -0
  72. package/dist/schedule/schedulePane.js.map +1 -0
  73. package/dist/sharing/sharingPane.js +36 -32
  74. package/dist/sharing/sharingPane.js.map +1 -1
  75. package/dist/slideshow/slideshowPane.js +80 -0
  76. package/dist/slideshow/slideshowPane.js.map +1 -0
  77. package/dist/socialPane.js +430 -0
  78. package/dist/socialPane.js.map +1 -0
  79. package/dist/tabbed/tabbedPane.js +54 -51
  80. package/dist/tabbed/tabbedPane.js.map +1 -1
  81. package/dist/tableViewPane.js +57 -0
  82. package/dist/tableViewPane.js.map +1 -0
  83. package/dist/transaction/pane.js +478 -0
  84. package/dist/transaction/pane.js.map +1 -0
  85. package/dist/transaction/period.js +324 -0
  86. package/dist/transaction/period.js.map +1 -0
  87. package/dist/trip/tripPane.js +175 -0
  88. package/dist/trip/tripPane.js.map +1 -0
  89. package/dist/trustedApplications/trustedApplications.dom.js +134 -146
  90. package/dist/trustedApplications/trustedApplications.dom.js.map +1 -1
  91. package/dist/trustedApplications/trustedApplications.utils.js +20 -20
  92. package/dist/trustedApplications/trustedApplications.utils.js.map +1 -1
  93. package/dist/trustedApplications/trustedApplications.view.js +51 -57
  94. package/dist/trustedApplications/trustedApplications.view.js.map +1 -1
  95. package/dist/types.js +5 -1
  96. package/dist/types.js.map +1 -1
  97. package/dist/ui/pane.js +147 -0
  98. package/dist/ui/pane.js.map +1 -0
  99. package/dist/versionInfo.js +35 -29
  100. package/dist/versionInfo.js.map +1 -1
  101. package/dist/video/videoPane.js +43 -0
  102. package/dist/video/videoPane.js.map +1 -0
  103. package/package.json +4 -3
@@ -0,0 +1,888 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.schedulePane = void 0;
7
+ var UI = _interopRequireWildcard(require("solid-ui"));
8
+ var _solidLogic = require("solid-logic");
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ /* Scheduler Pane
11
+ **
12
+ **
13
+ */
14
+ /* global alert */
15
+ /* babel-plugin-inline-import './formsForSchedule.ttl' */
16
+ const formText = "@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n";
17
+ const $rdf = UI.rdf;
18
+ const ns = UI.ns;
19
+
20
+ // @@ Give other combos too-- see schedule ontology
21
+ const possibleAvailabilities = [ns.sched('No'), ns.sched('Maybe'), ns.sched('Yes')];
22
+ const schedulePane = exports.schedulePane = {
23
+ icon: UI.icons.iconBase + 'noun_346777.svg',
24
+ // @@ better?
25
+
26
+ name: 'schedule',
27
+ audience: [ns.solid('PowerUser')],
28
+ // Does the subject deserve an Scheduler pane?
29
+ label: function (subject, context) {
30
+ const kb = context.session.store;
31
+ const t = kb.findTypeURIs(subject);
32
+ if (t['http://www.w3.org/ns/pim/schedule#SchedulableEvent']) {
33
+ return 'Scheduling poll';
34
+ }
35
+ return null; // No under other circumstances
36
+ },
37
+ // Mint a new Schedule poll
38
+ mintClass: ns.sched('SchedulableEvent'),
39
+ mintNew: function (context, options) {
40
+ return new Promise(function (resolve, reject) {
41
+ const ns = UI.ns;
42
+ const kb = context.session.store;
43
+ let newBase = options.newBase;
44
+ const thisInstance = options.useExisting || $rdf.sym(options.newBase + 'index.ttl#this');
45
+ const complainIfBad = function (ok, body) {
46
+ if (ok) return;
47
+ console.log('Error in Schedule Pane: Error constructing new scheduler: ' + body);
48
+ reject(new Error(body));
49
+ };
50
+
51
+ // ////////////////////// Accesss control
52
+
53
+ // Two constiations of ACL for this app, public read and public read/write
54
+ // In all cases owner has read write control
55
+
56
+ const genACLtext = function (docURI, aclURI, allWrite) {
57
+ const g = $rdf.graph();
58
+ const auth = $rdf.Namespace('http://www.w3.org/ns/auth/acl#');
59
+ let a = g.sym(aclURI + '#a1');
60
+ const acl = g.sym(aclURI);
61
+ const doc = g.sym(docURI);
62
+ g.add(a, UI.ns.rdf('type'), auth('Authorization'), acl);
63
+ g.add(a, auth('accessTo'), doc, acl);
64
+ g.add(a, auth('agent'), me, acl);
65
+ g.add(a, auth('mode'), auth('Read'), acl);
66
+ g.add(a, auth('mode'), auth('Write'), acl);
67
+ g.add(a, auth('mode'), auth('Control'), acl);
68
+ a = g.sym(aclURI + '#a2');
69
+ g.add(a, UI.ns.rdf('type'), auth('Authorization'), acl);
70
+ g.add(a, auth('accessTo'), doc, acl);
71
+ g.add(a, auth('agentClass'), ns.foaf('Agent'), acl);
72
+ g.add(a, auth('mode'), auth('Read'), acl);
73
+ if (allWrite) {
74
+ g.add(a, auth('mode'), auth('Write'), acl);
75
+ }
76
+ return $rdf.serialize(acl, g, aclURI, 'text/turtle');
77
+ };
78
+
79
+ /*
80
+ const setACL3 = function (docURI, allWrite, callbackFunction) {
81
+ const aclText = genACLtext(docURI, aclDoc.uri, allWrite)
82
+ return UI.acl.setACL(docURI, aclText, callbackFunction)
83
+ }
84
+ */
85
+
86
+ const setACL2 = function setACL2(docURI, allWrite, callbackFunction) {
87
+ const aclDoc = kb.any(kb.sym(docURI), kb.sym('http://www.iana.org/assignments/link-relations/acl')); // @@ check that this get set by web.js
88
+
89
+ if (aclDoc) {
90
+ // Great we already know where it is
91
+ const aclText = genACLtext(docURI, aclDoc.uri, allWrite);
92
+ return fetcher.webOperation('PUT', aclDoc.uri, {
93
+ data: aclText,
94
+ contentType: 'text/turtle'
95
+ }).then(_result => callbackFunction(true)).catch(err => {
96
+ callbackFunction(false, err.message);
97
+ });
98
+ } else {
99
+ return fetcher.load(docURI).catch(err => {
100
+ callbackFunction(false, 'Getting headers for ACL: ' + err);
101
+ }).then(() => {
102
+ const aclDoc = kb.any(kb.sym(docURI), kb.sym('http://www.iana.org/assignments/link-relations/acl'));
103
+ if (!aclDoc) {
104
+ // complainIfBad(false, "No Link rel=ACL header for " + docURI)
105
+ throw new Error('No Link rel=ACL header for ' + docURI);
106
+ }
107
+ const aclText = genACLtext(docURI, aclDoc.uri, allWrite);
108
+ return fetcher.webOperation('PUT', aclDoc.uri, {
109
+ data: aclText,
110
+ contentType: 'text/turtle'
111
+ });
112
+ }).then(_result => callbackFunction(true)).catch(err => {
113
+ callbackFunction(false, err.message);
114
+ });
115
+ }
116
+ };
117
+
118
+ // Body of mintNew
119
+ const fetcher = kb.fetcher;
120
+ const updater = kb.updater;
121
+ let me = options.me || _solidLogic.authn.currentUser();
122
+ if (!me) {
123
+ console.log('MUST BE LOGGED IN');
124
+ alert('NOT LOGGED IN');
125
+ return;
126
+ }
127
+ const base = thisInstance.dir().uri;
128
+ let newDetailsDoc, newInstance; // , newIndexDoc
129
+
130
+ if (options.useExisting) {
131
+ newInstance = options.useExisting;
132
+ newBase = thisInstance.dir().uri;
133
+ newDetailsDoc = newInstance.doc();
134
+ // newIndexDoc = null
135
+ if (options.newBase) {
136
+ throw new Error('mint new scheduler: Illegal - have both new base and existing event');
137
+ }
138
+ } else {
139
+ newDetailsDoc = kb.sym(newBase + 'details.ttl');
140
+ // newIndexDoc = kb.sym(newBase + 'index.html')
141
+ newInstance = kb.sym(newDetailsDoc.uri + '#event');
142
+ }
143
+ const newResultsDoc = kb.sym(newBase + 'results.ttl');
144
+ const toBeCopied = options.noIndexHTML ? {} : [{
145
+ local: 'index.html',
146
+ contentType: 'text/html'
147
+ }];
148
+ const agenda = [];
149
+
150
+ // @@ This needs some form of visible progress bar
151
+ for (let f = 0; f < toBeCopied.length; f++) {
152
+ const item = toBeCopied[f];
153
+ const fun = function copyItem(item) {
154
+ agenda.push(function () {
155
+ const newURI = newBase + item.local;
156
+ console.log('Copying ' + base + item.local + ' to ' + newURI);
157
+ const setThatACL = function () {
158
+ setACL2(newURI, false, function (ok, message) {
159
+ if (!ok) {
160
+ complainIfBad(ok, 'FAILED to set ACL ' + newURI + ' : ' + message);
161
+ console.log('FAILED to set ACL ' + newURI + ' : ' + message);
162
+ } else {
163
+ agenda.shift()(); // beware too much nesting
164
+ }
165
+ });
166
+ };
167
+ kb.fetcher.webCopy(base + item.local, newBase + item.local, item.contentType).then(() => _solidLogic.authn.checkUser()).then(webId => {
168
+ me = webId;
169
+ setThatACL();
170
+ }).catch(err => {
171
+ console.log('FAILED to copy ' + base + item.local + ' : ' + err.message);
172
+ complainIfBad(false, 'FAILED to copy ' + base + item.local + ' : ' + err.message);
173
+ });
174
+ });
175
+ };
176
+ fun(item);
177
+ }
178
+ agenda.push(function createDetailsFile() {
179
+ kb.add(newInstance, ns.rdf('type'), ns.sched('SchedulableEvent'), newDetailsDoc);
180
+ if (me) {
181
+ kb.add(newInstance, ns.dc('author'), me, newDetailsDoc); // Who is sending the invitation?
182
+ kb.add(newInstance, ns.foaf('maker'), me, newDetailsDoc); // Uneditable - wh is allowed to edit this?
183
+ }
184
+ kb.add(newInstance, ns.dc('created'), new Date(), newDetailsDoc);
185
+ kb.add(newInstance, ns.sched('resultsDocument'), newDetailsDoc);
186
+ updater.put(newDetailsDoc, kb.statementsMatching(undefined, undefined, undefined, newDetailsDoc), 'text/turtle', function (uri2, ok, message) {
187
+ if (ok) {
188
+ agenda.shift()();
189
+ } else {
190
+ complainIfBad(ok, 'FAILED to save new scheduler at: ' + newDetailsDoc + ' : ' + message);
191
+ console.log('FAILED to save new scheduler at: ' + newDetailsDoc + ' : ' + message);
192
+ }
193
+ });
194
+ });
195
+ agenda.push(function () {
196
+ kb.fetcher.webOperation('PUT', newResultsDoc.uri, {
197
+ data: '',
198
+ contentType: 'text/turtle'
199
+ }).then(() => {
200
+ agenda.shift()();
201
+ }).catch(err => {
202
+ complainIfBad(false, 'Failed to initialize empty results file: ' + err.message);
203
+ });
204
+ });
205
+ agenda.push(function () {
206
+ setACL2(newResultsDoc.uri, true, function (ok, body) {
207
+ complainIfBad(ok, 'Failed to set Read-Write ACL on results file: ' + body);
208
+ if (ok) agenda.shift()();
209
+ });
210
+ });
211
+ agenda.push(function () {
212
+ setACL2(newDetailsDoc.uri, false, function (ok, body) {
213
+ complainIfBad(ok, 'Failed to set read ACL on configuration file: ' + body);
214
+ if (ok) agenda.shift()();
215
+ });
216
+ });
217
+ agenda.push(function () {
218
+ // give the user links to the new app
219
+ console.log('Finished minting new scheduler');
220
+ options.newInstance = newInstance;
221
+ resolve(options);
222
+ });
223
+ agenda.shift()();
224
+ // Created new data files.
225
+ }); // promise
226
+ },
227
+ // mintNew
228
+
229
+ // Render one meeting schedule poll
230
+ render: function (subject, context) {
231
+ const dom = context.dom;
232
+ const kb = context.session.store;
233
+ const ns = UI.ns;
234
+ const invitation = subject;
235
+ const appPathSegment = 'app-when-can-we.w3.org'; // how to allocate this string and connect to
236
+
237
+ // ////////////////////////////////////////////
238
+
239
+ const fetcher = kb.fetcher;
240
+ const updater = kb.updater;
241
+ let waitingForLogin = false;
242
+ const thisInstance = subject;
243
+ const detailsDoc = subject.doc();
244
+ const baseDir = detailsDoc.dir();
245
+ const base = baseDir.uri;
246
+ const resultsDoc = $rdf.sym(base + 'results.ttl');
247
+ // const formsURI = base + 'forms.ttl'
248
+ // We can't in fact host stuff from there because of CORS
249
+ const formsURI = 'https://solidos.github.io/solid-panes/schedule/formsForSchedule.ttl';
250
+ const form1 = kb.sym(formsURI + '#form1');
251
+ const form2 = kb.sym(formsURI + '#form2');
252
+ const form3 = kb.sym(formsURI + '#form3');
253
+ $rdf.parse(formText, kb, formsURI, 'text/turtle'); // Load forms directly
254
+
255
+ const inputStyle = 'background-color: #eef; padding: 0.5em; border: .5em solid white; font-size: 100%'; // font-size: 120%
256
+ const buttonIconStyle = 'width: 1.8em; height: 1.8em;';
257
+
258
+ // Utility functions
259
+
260
+ const complainIfBad = function (ok, message) {
261
+ if (!ok) {
262
+ div.appendChild(UI.widgets.errorMessageBlock(dom, message, 'pink'));
263
+ }
264
+ };
265
+ const clearElement = function (ele) {
266
+ while (ele.firstChild) {
267
+ ele.removeChild(ele.firstChild);
268
+ }
269
+ return ele;
270
+ };
271
+ const refreshCellColor = function (cell, value) {
272
+ const bg = kb.any(value, UI.ns.ui('backgroundColor'));
273
+ if (bg) {
274
+ cell.setAttribute('style', 'padding: 0.3em; text-align: center; background-color: ' + bg + ';');
275
+ }
276
+ };
277
+ let me;
278
+ _solidLogic.authn.checkUser().then(webId => {
279
+ me = webId;
280
+ if (logInOutButton) {
281
+ logInOutButton.refresh();
282
+ }
283
+ if (webId && waitingForLogin) {
284
+ waitingForLogin = false;
285
+ showAppropriateDisplay();
286
+ }
287
+ });
288
+ console.log('me: ' + me); // @@ curently not actually used elsewhere
289
+
290
+ // ////////////////////////////// Reproduction: spawn a new instance
291
+ //
292
+ // Viral growth path: user of app decides to make another instance
293
+ //
294
+
295
+ const newInstanceButton = function () {
296
+ const b = UI.login.newAppInstance(dom, {
297
+ noun: 'scheduler'
298
+ }, initializeNewInstanceInWorkspace);
299
+ b.firstChild.setAttribute('style', inputStyle);
300
+ return b;
301
+ }; // newInstanceButton
302
+
303
+ // /////////////////////// Create new document files for new instance of app
304
+
305
+ const initializeNewInstanceInWorkspace = function (ws) {
306
+ let newBase = kb.any(ws, ns.space('uriPrefix'));
307
+ if (!newBase) {
308
+ newBase = ws.uri.split('#')[0];
309
+ } else {
310
+ newBase = newBase.value;
311
+ }
312
+ if (newBase.slice(-1) !== '/') {
313
+ $rdf.log.error(appPathSegment + ': No / at end of uriPrefix ' + newBase); // @@ paramater?
314
+ newBase = newBase + '/';
315
+ }
316
+ const now = new Date();
317
+ newBase += appPathSegment + '/id' + now.getTime() + '/'; // unique id
318
+
319
+ initializeNewInstanceAtBase(thisInstance, newBase);
320
+ };
321
+ const initializeNewInstanceAtBase = function (thisInstance, newBase) {
322
+ const options = {
323
+ thisInstance,
324
+ newBase
325
+ };
326
+ this.mintNew(context, options).then(function (options) {
327
+ const p = div.appendChild(dom.createElement('p'));
328
+ p.setAttribute('style', 'font-size: 140%;');
329
+ p.innerHTML = 'Your <a href=\'' + options.newInstance.uri + '\'><b>new scheduler</b></a> is ready to be set up. ' + '<br/><br/><a href=\'' + options.newInstance.uri + '\'>Say when you what days work for you.</a>';
330
+ }).catch(function (error) {
331
+ complainIfBad(false, 'Error createing new scheduler at ' + options.newInstance + ': ' + error);
332
+ });
333
+ };
334
+
335
+ // ///////////////////////
336
+
337
+ const getForms = function () {
338
+ console.log('getforms()');
339
+ getDetails();
340
+ /*
341
+ fetcher.nowOrWhenFetched(formsURI, undefined, function (ok, body) {
342
+ console.log('getforms() ok? ' + ok)
343
+ if (!ok) return complainIfBad(ok, body)
344
+ getDetails()
345
+ })
346
+ */
347
+ };
348
+ const getDetails = function () {
349
+ console.log('getDetails()'); // Looking for blank screen hang-up
350
+ fetcher.nowOrWhenFetched(detailsDoc.uri, undefined, function (ok, body) {
351
+ console.log('getDetails() ok? ' + ok);
352
+ if (!ok) return complainIfBad(ok, body);
353
+ showAppropriateDisplay();
354
+ });
355
+ };
356
+ const showAppropriateDisplay = function showAppropriateDisplay() {
357
+ console.log('showAppropriateDisplay()');
358
+ _solidLogic.authn.checkUser().then(webId => {
359
+ if (!webId) {
360
+ return showSignon();
361
+ }
362
+
363
+ // On gh-pages, the turtle will not load properly (bad mime type)
364
+ // but we can trap it as being a non-editable server.
365
+
366
+ if (!kb.updater.editable(detailsDoc.uri, kb) || kb.holds(subject, ns.rdf('type'), ns.wf('TemplateInstance'))) {
367
+ // This is read-only example e.g. on github pages, etc
368
+ showBootstrap(div);
369
+ return;
370
+ }
371
+ const ready = kb.any(subject, ns.sched('ready'));
372
+ if (!ready) {
373
+ showForms();
374
+ } else {
375
+ // no editing not author
376
+ getResults();
377
+ }
378
+ });
379
+ };
380
+ const showSignon = function showSignon() {
381
+ clearElement(naviMain);
382
+ const signonContext = {
383
+ div,
384
+ dom
385
+ };
386
+ UI.login.ensureLoggedIn(signonContext).then(context => {
387
+ me = context.me;
388
+ waitingForLogin = false; // untested
389
+ showAppropriateDisplay();
390
+ });
391
+ };
392
+ const showBootstrap = function showBootstrap() {
393
+ const div = clearElement(naviMain);
394
+ div.appendChild(UI.login.newAppInstance(dom, {
395
+ noun: 'poll'
396
+ }, initializeNewInstanceInWorkspace));
397
+ div.appendChild(dom.createElement('hr')); // @@
398
+
399
+ const p = div.appendChild(dom.createElement('p'));
400
+ p.textContent = 'Where would you like to store the data for the poll? ' + 'Give the URL of the directory where you would like the data stored.';
401
+ const baseField = div.appendChild(dom.createElement('input'));
402
+ baseField.setAttribute('type', 'text');
403
+ baseField.size = 80; // really a string
404
+ baseField.label = 'base URL';
405
+ baseField.autocomplete = 'on';
406
+ div.appendChild(dom.createElement('br')); // @@
407
+
408
+ const button = div.appendChild(dom.createElement('button'));
409
+ button.setAttribute('style', inputStyle);
410
+ button.textContent = 'Start new poll at this URI';
411
+ button.addEventListener('click', function (_e) {
412
+ let newBase = baseField.value;
413
+ if (newBase.slice(-1) !== '/') {
414
+ newBase += '/';
415
+ }
416
+ initializeNewInstanceAtBase(thisInstance, newBase);
417
+ });
418
+ };
419
+
420
+ // ///////////// The forms to configure the poll
421
+
422
+ const doneButton = dom.createElement('button');
423
+ const showForms = function () {
424
+ clearElement(naviCenter); // Remove refresh button if nec
425
+ const div = naviMain;
426
+ const wizard = true;
427
+ let currentSlide = 0;
428
+ let gotDoneButton = false;
429
+ if (wizard) {
430
+ const forms = [form1, form2, form3];
431
+ const slides = [];
432
+ currentSlide = 0;
433
+ for (let f = 0; f < forms.length; f++) {
434
+ const slide = dom.createElement('div');
435
+ UI.widgets.appendForm(document, slide, {}, subject, forms[f], detailsDoc, complainIfBad);
436
+ slides.push(slide);
437
+ }
438
+ const refresh = function () {
439
+ clearElement(naviMain).appendChild(slides[currentSlide]);
440
+ if (currentSlide === 0) {
441
+ b1.setAttribute('disabled', '');
442
+ } else {
443
+ b1.removeAttribute('disabled');
444
+ }
445
+ if (currentSlide === slides.length - 1) {
446
+ b2.setAttribute('disabled', '');
447
+ if (!gotDoneButton) {
448
+ // Only expose at last slide seen
449
+ naviCenter.appendChild(emailButton); // could also check data shape
450
+ naviCenter.appendChild(doneButton); // could also check data shape
451
+ gotDoneButton = true;
452
+ }
453
+ } else {
454
+ b2.removeAttribute('disabled');
455
+ }
456
+ };
457
+ const b1 = clearElement(naviLeft).appendChild(dom.createElement('button'));
458
+ b1.setAttribute('style', inputStyle);
459
+ b1.textContent = '<- go back';
460
+ b1.addEventListener('click', function (_e) {
461
+ if (currentSlide > 0) {
462
+ currentSlide -= 1;
463
+ refresh();
464
+ }
465
+ }, false);
466
+ const b2 = clearElement(naviRight).appendChild(dom.createElement('button'));
467
+ b2.setAttribute('style', inputStyle);
468
+ b2.textContent = 'continue ->';
469
+ b2.addEventListener('click', function (_e) {
470
+ if (currentSlide < slides.length - 1) {
471
+ currentSlide += 1;
472
+ refresh();
473
+ }
474
+ }, false);
475
+ refresh();
476
+ } else {
477
+ // not wizard one big form
478
+ // @@@ create the initial config doc if not exist
479
+ const table = div.appendChild(dom.createElement('table'));
480
+ UI.widgets.appendForm(document, table, {}, subject, form1, detailsDoc, complainIfBad);
481
+ UI.widgets.appendForm(document, table, {}, subject, form2, detailsDoc, complainIfBad);
482
+ UI.widgets.appendForm(document, table, {}, subject, form3, detailsDoc, complainIfBad);
483
+ naviCenter.appendChild(doneButton); // could also check data shape
484
+ }
485
+ // @@@ link config to results
486
+
487
+ const insertables = [];
488
+ insertables.push($rdf.st(subject, ns.sched('availabilityOptions'), ns.sched('YesNoMaybe'), detailsDoc));
489
+ insertables.push($rdf.st(subject, ns.sched('ready'), new Date(), detailsDoc));
490
+ insertables.push($rdf.st(subject, ns.sched('results'), resultsDoc, detailsDoc)); // @@ also link in results
491
+
492
+ doneButton.setAttribute('style', inputStyle);
493
+ doneButton.textContent = 'Go to poll';
494
+ doneButton.addEventListener('click', function (_e) {
495
+ if (kb.any(subject, ns.sched('ready'))) {
496
+ // already done
497
+ getResults();
498
+ naviRight.appendChild(emailButton);
499
+ } else {
500
+ naviRight.appendChild(emailButton);
501
+ kb.updater.update([], insertables, function (uri, success, errorBody) {
502
+ if (!success) {
503
+ complainIfBad(success, errorBody);
504
+ } else {
505
+ // naviRight.appendChild(emailButton)
506
+ getResults();
507
+ }
508
+ });
509
+ }
510
+ }, false);
511
+ const emailButton = dom.createElement('button');
512
+ emailButton.setAttribute('style', inputStyle);
513
+ const emailIcon = emailButton.appendChild(dom.createElement('img'));
514
+ emailIcon.setAttribute('src', UI.icons.iconBase + 'noun_480183.svg'); // noun_480183.svg
515
+ emailIcon.setAttribute('style', buttonIconStyle);
516
+ // emailButton.textContent = 'email invitations'
517
+ emailButton.addEventListener('click', function (_e) {
518
+ const title = kb.anyValue(subject, ns.cal('summary')) || kb.anyValue(subject, ns.dc('title')) || '';
519
+ const mailto = 'mailto:' + kb.each(subject, ns.sched('invitee')).map(function (who) {
520
+ const mbox = kb.any(who, ns.foaf('mbox'));
521
+ return mbox ? mbox.uri.replace('mailto:', '') : '';
522
+ }).join(',') + '?subject=' + encodeURIComponent(title + '-- When can we meet?') + '&body=' + encodeURIComponent(title + '\n\nWhen can you?\n\nSee ' + subject + '\n');
523
+ // @@ assumed there is a data browser
524
+
525
+ console.log('Mail: ' + mailto);
526
+ window.location.href = mailto;
527
+ }, false);
528
+ }; // showForms
529
+
530
+ // Ask for each day, what times .. @@ to be added some time
531
+ /*
532
+ const setTimesOfDay = function () {
533
+ const i, j, x, y, slot, cell, day
534
+ const insertables = []
535
+ const possibleDays = kb.each(invitation, ns.sched('option'))
536
+ .map(function (opt) {return kb.any(opt, ns.cal('dtstart'))})
537
+ const cellLookup = []
538
+ const slots = kb.each(invitation, ns.sched('slot'))
539
+ if (slots.length === 0) {
540
+ for (i = 0; i < 2; i++) {
541
+ slot = UI.widgets.newThing(detailsDoc)
542
+ insertables.push($rdf.st(invitation, ns.sched('slot'), slot))
543
+ insertables.push($rdf.st(slot, ns.rdfs('label'), 'slot ' + (i + 1)))
544
+ for (j = 0; j < possibleDays.length; j++) {
545
+ day - possibleDays[j]
546
+ x = kb.any(slot, ns.rdfs('label'))
547
+ y = kb.any(day, ns.cal('dtstart'))
548
+ cell = UI.widgets.newThing(detailsDoc)
549
+ cellLookup[x.toNT() + y.toNT()] = cell
550
+ insertables.push($rdf.st(slot, ns.sched('cell'), cell))
551
+ insertables.push($rdf.st(cell, ns.sched('day'), possibleDays[j]))
552
+ }
553
+ }
554
+ }
555
+ const query = new $rdf.Query('TimesOfDay')
556
+ const v = {}['day', 'label', 'value', 'slot', 'cell'].map(function (x) {
557
+ query.consts.push(v[x] = $rdf.constiable(x)) })
558
+ query.pat.add(invitation, ns.sched('slot'), v.slot)
559
+ query.pat.add(v.slot, ns.rdfs('label'), v.label)
560
+ query.pat.add(v.slot, ns.sched('cell'), v.cell)
561
+ query.pat.add(v.cell, ns.sched('timeOfDay'), v.value)
562
+ query.pat.add(v.cell, ns.sched('day'), v.day)
563
+ const options = {}
564
+ options.set_x = kb.each(subject, ns.sched('slot')) // @@@@@ option -> dtstart in future
565
+ options.set_x = options.set_x.map(function (opt) { return kb.any(opt, ns.rdfs('label')) })
566
+ options.set_y = kb.each(subject, ns.sched('option')); // @@@@@ option -> dtstart in future
567
+ options.set_y = options.set_y.map(function (opt) { return kb.any(opt, ns.cal('dtstart')) })
568
+ const possibleTimes = kb.each(invitation, ns.sched('option'))
569
+ .map(function (opt) { return kb.any(opt, ns.cal('dtstart')) })
570
+ const displayTheMatrix = function () {
571
+ const matrix = div.appendChild(UI.matrix.matrixForQuery(
572
+ dom, query, v.time, v.author, v.value, options, function () {}))
573
+ matrix.setAttribute('class', 'matrix')
574
+ const refreshButton = dom.createElement('button')
575
+ refreshButton.setAttribute('style', inputStyle)
576
+ refreshButton.textContent = 'refresh'
577
+ refreshButton.addEventListener('click', function (e) {
578
+ refreshButton.disabled = true
579
+ store.fetcher.nowOrWhenFetched(subject.doc(), undefined, function (ok, body) {
580
+ if (!ok) {
581
+ console.log('Cant refresh matrix' + body)
582
+ } else {
583
+ matrix.refresh()
584
+ refreshButton.disabled = false
585
+ }
586
+ })
587
+ }, false)
588
+ clearElement(naviCenter)
589
+ naviCenter.appendChild(refreshButton)
590
+ }
591
+ const dataPointForNT = []
592
+ const doc = resultsDoc
593
+ options.set_y = options.set_y.filter(function (z) { return (! z.sameTerm(me)) })
594
+ options.set_y.push(me) // Put me on the end
595
+ options.cellFunction = function (cell, x, y, value) {
596
+ // const point = cellLookup[x.toNT() + y.toNT()]
597
+ if (y.sameTerm(me)) {
598
+ const callbackFunction = function () { refreshCellColor(cell, value); }; // @@ may need that
599
+ const selectOptions = {}
600
+ const predicate = ns.sched('timeOfDay')
601
+ const cellSubject = dataPointForNT[x.toNT()]
602
+ const selector = UI.widgets.makeSelectForOptions(dom, kb, cellSubject, predicate,
603
+ possibleAvailabilities, selectOptions, resultsDoc, callbackFunction)
604
+ cell.appendChild(selector)
605
+ } else if (value !== null) {
606
+ cell.textContent = UI.utils.label(value)
607
+ }
608
+ }
609
+ const responses = kb.each(invitation, ns.sched('response'))
610
+ const myResponse = null
611
+ responses.map(function (r) {
612
+ if (kb.holds(r, ns.dc('author'), me)) {
613
+ myResponse = r
614
+ }
615
+ })
616
+ const id = UI.widgets.newThing(doc).uri
617
+ if (myResponse === null) {
618
+ myResponse = $rdf.sym(id + '_response')
619
+ insertables.push($rdf.st(invitation, ns.sched('response'), myResponse, doc))
620
+ insertables.push($rdf.st(myResponse, ns.dc('author'), me, doc))
621
+ } else {
622
+ const dps = kb.each(myResponse, ns.sched('cell'))
623
+ dps.map(function (dataPoint) {
624
+ const time = kb.any(dataPoint, ns.cal('dtstart'))
625
+ dataPointForNT[time.toNT()] = dataPoint
626
+ })
627
+ }
628
+ for (let j = 0; j < possibleTimes.length; j++) {
629
+ if (dataPointForNT[possibleTimes[j].toNT()]) continue
630
+ const dataPoint = $rdf.sym(id + '_' + j)
631
+ insertables.push($rdf.st(myResponse, ns.sched('cell'), dataPoint, doc))
632
+ insertables.push($rdf.st(dataPoint, ns.cal('dtstart'), possibleTimes[j], doc)) // @@
633
+ dataPointForNT[possibleTimes[j].toNT()] = dataPoint
634
+ }
635
+ if (insertables.length) {
636
+ store.updater.update([], insertables, function (uri, success, errorBody) {
637
+ if (!success) {
638
+ complainIfBad(success, errorBody)
639
+ } else {
640
+ displayTheMatrix()
641
+ }
642
+ })
643
+ } else { // no insertables
644
+ displayTheMatrix()
645
+ }
646
+ }
647
+ */
648
+ // end setTimesOfDay
649
+
650
+ // Read or create empty results file
651
+ function getResults() {
652
+ fetcher.nowOrWhenFetched(resultsDoc.uri, (ok, body, response) => {
653
+ if (!ok) {
654
+ if (response.status === 404) {
655
+ // / Check explicitly for 404 error
656
+ console.log('Initializing details file ' + resultsDoc);
657
+ updater.put(resultsDoc, [], 'text/turtle', function (uri2, ok, message) {
658
+ if (ok) {
659
+ clearElement(naviMain);
660
+ showResults();
661
+ } else {
662
+ complainIfBad(ok, 'FAILED to create results file at: ' + resultsDoc.uri + ' : ' + message);
663
+ console.log('FAILED to craete results file at: ' + resultsDoc.uri + ' : ' + message);
664
+ }
665
+ });
666
+ } else {
667
+ // Other error, not 404 -- do not try to overwite the file
668
+ complainIfBad(ok, 'FAILED to read results file: ' + body);
669
+ }
670
+ } else {
671
+ // Happy read
672
+ clearElement(naviMain);
673
+ showResults();
674
+ }
675
+ });
676
+ }
677
+ function showResults() {
678
+ // Now the form for responsing to the poll
679
+ //
680
+
681
+ // div.appendChild(dom.createElement('hr'))
682
+
683
+ // const invitation = subject
684
+ const title = kb.any(invitation, ns.cal('summary'));
685
+ const comment = kb.any(invitation, ns.cal('comment'));
686
+ const location = kb.any(invitation, ns.cal('location'));
687
+ const div = naviMain;
688
+ if (title) div.appendChild(dom.createElement('h3')).textContent = title;
689
+ if (location) {
690
+ div.appendChild(dom.createElement('address')).textContent = location.value;
691
+ }
692
+ if (comment) {
693
+ div.appendChild(dom.createElement('p')).textContent = comment.value;
694
+ }
695
+ const author = kb.any(invitation, ns.dc('author'));
696
+ if (author) {
697
+ const authorName = kb.any(author, ns.foaf('name'));
698
+ if (authorName) {
699
+ div.appendChild(dom.createElement('p')).textContent = authorName;
700
+ }
701
+ }
702
+ const query = new $rdf.Query('Responses');
703
+ const v = {};
704
+ const vs = ['time', 'author', 'value', 'resp', 'cell'];
705
+ vs.forEach(function (x) {
706
+ query.vars.push(v[x] = $rdf.variable(x));
707
+ });
708
+ query.pat.add(invitation, ns.sched('response'), v.resp);
709
+ query.pat.add(v.resp, ns.dc('author'), v.author);
710
+ query.pat.add(v.resp, ns.sched('cell'), v.cell);
711
+ query.pat.add(v.cell, ns.sched('availabilty'), v.value);
712
+ query.pat.add(v.cell, ns.cal('dtstart'), v.time);
713
+
714
+ // Sort by by person @@@
715
+
716
+ const options = {};
717
+ options.set_x = kb.each(subject, ns.sched('option')); // @@@@@ option -> dtstart in future
718
+ options.set_x = options.set_x.map(function (opt) {
719
+ return kb.any(opt, ns.cal('dtstart'));
720
+ });
721
+ options.set_y = kb.each(subject, ns.sched('response'));
722
+ options.set_y = options.set_y.map(function (resp) {
723
+ return kb.any(resp, ns.dc('author'));
724
+ });
725
+ const possibleTimes = kb.each(invitation, ns.sched('option')).map(function (opt) {
726
+ return kb.any(opt, ns.cal('dtstart'));
727
+ });
728
+ const displayTheMatrix = function () {
729
+ const matrix = div.appendChild(UI.matrix.matrixForQuery(dom, query, v.time, v.author, v.value, options, function () {}));
730
+ matrix.setAttribute('class', 'matrix');
731
+ const refreshButton = dom.createElement('button');
732
+ refreshButton.setAttribute('style', inputStyle);
733
+ // refreshButton.textContent = 'refresh' // noun_479395.svg
734
+ const refreshIcon = dom.createElement('img');
735
+ refreshIcon.setAttribute('src', UI.icons.iconBase + 'noun_479395.svg');
736
+ refreshIcon.setAttribute('style', buttonIconStyle);
737
+ refreshButton.appendChild(refreshIcon);
738
+ refreshButton.addEventListener('click', function (_e) {
739
+ refreshButton.disabled = true;
740
+ kb.fetcher.refresh(resultsDoc, function (ok, body) {
741
+ if (!ok) {
742
+ console.log('Cant refresh matrix' + body);
743
+ } else {
744
+ matrix.refresh();
745
+ refreshButton.disabled = false;
746
+ }
747
+ });
748
+ }, false);
749
+ clearElement(naviCenter);
750
+ naviCenter.appendChild(refreshButton);
751
+ };
752
+
753
+ // @@ Give other combos too-- see schedule ontology
754
+ // const possibleAvailabilities = [ SCHED('No'), SCHED('Maybe'), SCHED('Yes') ]
755
+
756
+ // const me = authn.currentUser()
757
+
758
+ const dataPointForNT = [];
759
+ const loginContext = {
760
+ div: naviCenter,
761
+ dom
762
+ };
763
+ UI.login.ensureLoggedIn(loginContext).then(context => {
764
+ const me = context.me;
765
+ const doc = resultsDoc;
766
+ options.set_y = options.set_y.filter(function (z) {
767
+ return !z.sameTerm(me);
768
+ });
769
+ options.set_y.push(me); // Put me on the end
770
+
771
+ options.cellFunction = function (cell, x, y, value) {
772
+ if (value !== null) {
773
+ kb.fetcher.nowOrWhenFetched(value.uri.split('#')[0], undefined, function (ok, _error) {
774
+ if (ok) refreshCellColor(cell, value);
775
+ });
776
+ }
777
+ if (y.sameTerm(me)) {
778
+ const callbackFunction = function () {
779
+ refreshCellColor(cell, value);
780
+ }; // @@ may need that
781
+ const selectOptions = {};
782
+ const predicate = ns.sched('availabilty');
783
+ const cellSubject = dataPointForNT[x.toNT()];
784
+ const selector = UI.widgets.makeSelectForOptions(dom, kb, cellSubject, predicate, possibleAvailabilities, selectOptions, resultsDoc, callbackFunction);
785
+ cell.appendChild(selector);
786
+ } else if (value !== null) {
787
+ cell.textContent = UI.utils.label(value);
788
+ }
789
+ };
790
+ const responses = kb.each(invitation, ns.sched('response'));
791
+ let myResponse = null;
792
+ responses.forEach(function (r) {
793
+ if (kb.holds(r, ns.dc('author'), me)) {
794
+ myResponse = r;
795
+ }
796
+ });
797
+ const insertables = []; // list of statements to be stored
798
+
799
+ const id = UI.widgets.newThing(doc).uri;
800
+ if (myResponse === null) {
801
+ myResponse = $rdf.sym(id + '_response');
802
+ insertables.push($rdf.st(invitation, ns.sched('response'), myResponse, doc));
803
+ insertables.push($rdf.st(myResponse, ns.dc('author'), me, doc));
804
+ } else {
805
+ const dps = kb.each(myResponse, ns.sched('cell'));
806
+ dps.forEach(function (dataPoint) {
807
+ const time = kb.any(dataPoint, ns.cal('dtstart'));
808
+ dataPointForNT[time.toNT()] = dataPoint;
809
+ });
810
+ }
811
+ for (let j = 0; j < possibleTimes.length; j++) {
812
+ if (dataPointForNT[possibleTimes[j].toNT()]) continue;
813
+ const dataPoint = $rdf.sym(id + '_' + j);
814
+ insertables.push($rdf.st(myResponse, ns.sched('cell'), dataPoint, doc));
815
+ insertables.push($rdf.st(dataPoint, ns.cal('dtstart'), possibleTimes[j], doc)); // @@
816
+ dataPointForNT[possibleTimes[j].toNT()] = dataPoint;
817
+ }
818
+ if (insertables.length) {
819
+ kb.updater.update([], insertables, function (uri, success, errorBody) {
820
+ if (!success) {
821
+ complainIfBad(success, errorBody);
822
+ } else {
823
+ displayTheMatrix();
824
+ }
825
+ });
826
+ } else {
827
+ // no insertables
828
+ displayTheMatrix();
829
+ }
830
+ }); // @@@@ end of .then
831
+
832
+ // If I made this in the first place, allow me to edit it.
833
+ // @@ optionally -- allows others to if according to original
834
+ const instanceCreator = kb.any(subject, ns.foaf('maker')); // owner?
835
+ if (!instanceCreator || instanceCreator.sameTerm(me)) {
836
+ const editButton = dom.createElement('button');
837
+ editButton.setAttribute('style', inputStyle);
838
+ // editButton.textContent = '(Modify the poll)' // noun_344563.svg
839
+ const editIcon = dom.createElement('img');
840
+ editIcon.setAttribute('src', UI.icons.iconBase + 'noun_344563.svg');
841
+ editIcon.setAttribute('style', buttonIconStyle);
842
+ editButton.appendChild(editIcon);
843
+ editButton.addEventListener('click', function (_e) {
844
+ clearElement(div);
845
+ showForms();
846
+ }, false);
847
+ clearElement(naviLeft);
848
+ naviLeft.appendChild(editButton);
849
+ }
850
+
851
+ // div.appendChild(editButton)
852
+
853
+ clearElement(naviRight);
854
+ naviRight.appendChild(newInstanceButton());
855
+ } // showResults
856
+
857
+ const div = dom.createElement('div');
858
+ const structure = div.appendChild(dom.createElement('table')); // @@ make responsive style
859
+ structure.setAttribute('style', 'background-color: white; min-width: 40em; min-height: 13em;');
860
+ const naviLoginoutTR = structure.appendChild(dom.createElement('tr'));
861
+ naviLoginoutTR.appendChild(dom.createElement('td'));
862
+ naviLoginoutTR.appendChild(dom.createElement('td'));
863
+ naviLoginoutTR.appendChild(dom.createElement('td'));
864
+ const logInOutButton = null;
865
+ /*
866
+ const logInOutButton = UI.login.loginStatusBox(dom, setUser)
867
+ // floating divs lead to a mess
868
+ // logInOutButton.setAttribute('style', 'float: right') // float the beginning of the end
869
+ naviLoginout3.appendChild(logInOutButton)
870
+ logInOutButton.setAttribute('style', 'margin-right: 0em;')
871
+ */
872
+
873
+ const naviTop = structure.appendChild(dom.createElement('tr'));
874
+ const naviMain = naviTop.appendChild(dom.createElement('td'));
875
+ naviMain.setAttribute('colspan', '3');
876
+ const naviMenu = structure.appendChild(dom.createElement('tr'));
877
+ naviMenu.setAttribute('class', 'naviMenu');
878
+ naviMenu.setAttribute('style', ' text-align: middle; vertical-align: middle; padding-top: 4em; ');
879
+ // naviMenu.setAttribute('style', 'margin-top: 3em;')
880
+ const naviLeft = naviMenu.appendChild(dom.createElement('td'));
881
+ const naviCenter = naviMenu.appendChild(dom.createElement('td'));
882
+ const naviRight = naviMenu.appendChild(dom.createElement('td'));
883
+ getForms();
884
+ return div;
885
+ } // render
886
+ }; // property list
887
+ // ends
888
+ //# sourceMappingURL=schedulePane.js.map