solid-panes 3.7.2 → 3.7.3-125af630

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