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