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
package/lib/outline/manager.js
DELETED
|
@@ -1,2264 +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["default"] = _default;
|
|
8
|
-
var paneRegistry = _interopRequireWildcard(require("pane-registry"));
|
|
9
|
-
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
10
|
-
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
11
|
-
var _solidLogic = require("solid-logic");
|
|
12
|
-
var _propertyViews = require("./propertyViews");
|
|
13
|
-
var _outlineIcons = require("./outlineIcons.js");
|
|
14
|
-
var _userInput = require("./userInput.js");
|
|
15
|
-
var queryByExample = _interopRequireWildcard(require("./queryByExample.js"));
|
|
16
|
-
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 _t6 in e) "default" !== _t6 && {}.hasOwnProperty.call(e, _t6) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t6)) && (i.get || i.set) ? o(f, _t6, i) : f[_t6] = e[_t6]); return f; })(e, t); }
|
|
17
|
-
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
18
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
20
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
21
|
-
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
22
|
-
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
23
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
24
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
25
|
-
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
26
|
-
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; } /* istanbul ignore file */ /* -*- coding: utf-8-dos -*-
|
|
27
|
-
Outline Mode Manager
|
|
28
|
-
*/ // @@ chec
|
|
29
|
-
/* global alert XPathResult sourceWidget */
|
|
30
|
-
// XPathResult?
|
|
31
|
-
|
|
32
|
-
// const iconHeight = '24px'
|
|
33
|
-
|
|
34
|
-
function _default(context) {
|
|
35
|
-
var dom = context.dom;
|
|
36
|
-
this.document = context.dom;
|
|
37
|
-
this.outlineIcons = _outlineIcons.outlineIcons;
|
|
38
|
-
this.labeller = this.labeller || {};
|
|
39
|
-
this.labeller.LanguagePreference = ''; // for now
|
|
40
|
-
var outline = this; // Kenny: do we need this?
|
|
41
|
-
var thisOutline = this;
|
|
42
|
-
var selection = [];
|
|
43
|
-
this.selection = selection;
|
|
44
|
-
this.ancestor = UI.utils.ancestor; // make available as outline.ancestor in callbacks
|
|
45
|
-
this.sparql = UI.rdf.UpdateManager;
|
|
46
|
-
this.kb = _solidLogic.store;
|
|
47
|
-
var kb = _solidLogic.store;
|
|
48
|
-
var sf = _solidLogic.store.fetcher;
|
|
49
|
-
dom.outline = this;
|
|
50
|
-
this.qs = new queryByExample.QuerySource(); // Track queries in queryByExample
|
|
51
|
-
|
|
52
|
-
// var selection = [] // Array of statements which have been selected
|
|
53
|
-
// this.focusTd // the <td> that is being observed
|
|
54
|
-
this.UserInput = new _userInput.UserInput(this);
|
|
55
|
-
this.clipboardAddress = 'tabulator:clipboard'; // Weird
|
|
56
|
-
this.UserInput.clipboardInit(this.clipboardAddress);
|
|
57
|
-
var outlineElement = this.outlineElement;
|
|
58
|
-
this.init = function () {
|
|
59
|
-
var table = getOutlineContainer();
|
|
60
|
-
table.outline = this;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/** benchmark a function **/
|
|
64
|
-
benchmark.lastkbsize = 0;
|
|
65
|
-
function benchmark(f) {
|
|
66
|
-
var args = [];
|
|
67
|
-
for (var i = arguments.length - 1; i > 0; i--) args[i - 1] = arguments[i];
|
|
68
|
-
// UI.log.debug('BENCHMARK: args=' + args.join());
|
|
69
|
-
var begin = new Date().getTime();
|
|
70
|
-
var returnValue = f.apply(f, args);
|
|
71
|
-
var end = new Date().getTime();
|
|
72
|
-
UI.log.info('BENCHMARK: kb delta: ' + (kb.statements.length - benchmark.lastkbsize) + ', time elapsed for ' + f + ' was ' + (end - begin) + 'ms');
|
|
73
|
-
benchmark.lastkbsize = kb.statements.length;
|
|
74
|
-
return returnValue;
|
|
75
|
-
} // benchmark
|
|
76
|
-
|
|
77
|
-
// / ////////////////////// Representing data
|
|
78
|
-
|
|
79
|
-
// Represent an object in summary form as a table cell
|
|
80
|
-
|
|
81
|
-
function appendRemoveIcon(node, subject, removeNode) {
|
|
82
|
-
var image = UI.utils.AJARImage(_outlineIcons.outlineIcons.src.icon_remove_node, 'remove', undefined, dom);
|
|
83
|
-
image.addEventListener('click', removeNodeIconMouseDownListener);
|
|
84
|
-
// image.setAttribute('align', 'right') Causes icon to be moved down
|
|
85
|
-
image.node = removeNode;
|
|
86
|
-
image.setAttribute('about', subject.toNT());
|
|
87
|
-
image.style.marginLeft = '5px';
|
|
88
|
-
image.style.marginRight = '10px';
|
|
89
|
-
// image.style.border='solid #777 1px';
|
|
90
|
-
node.appendChild(image);
|
|
91
|
-
return image;
|
|
92
|
-
}
|
|
93
|
-
this.appendAccessIcons = function (kb, node, obj) {
|
|
94
|
-
if (obj.termType !== 'NamedNode') return;
|
|
95
|
-
var uris = kb.uris(obj);
|
|
96
|
-
uris.sort();
|
|
97
|
-
var last = null;
|
|
98
|
-
for (var i = 0; i < uris.length; i++) {
|
|
99
|
-
if (uris[i] === last) continue;
|
|
100
|
-
last = uris[i];
|
|
101
|
-
thisOutline.appendAccessIcon(node, last);
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
this.appendAccessIcon = function (node, uri) {
|
|
105
|
-
if (!uri) return '';
|
|
106
|
-
var docuri = UI.rdf.uri.docpart(uri);
|
|
107
|
-
if (docuri.slice(0, 5) !== 'http:') return '';
|
|
108
|
-
var state = sf.getState(docuri);
|
|
109
|
-
var icon, alt, listener;
|
|
110
|
-
switch (state) {
|
|
111
|
-
case 'unrequested':
|
|
112
|
-
icon = _outlineIcons.outlineIcons.src.icon_unrequested;
|
|
113
|
-
alt = 'fetch';
|
|
114
|
-
listener = unrequestedIconMouseDownListener;
|
|
115
|
-
break;
|
|
116
|
-
case 'requested':
|
|
117
|
-
icon = _outlineIcons.outlineIcons.src.icon_requested;
|
|
118
|
-
alt = 'fetching';
|
|
119
|
-
listener = failedIconMouseDownListener; // new: can retry yello blob
|
|
120
|
-
break;
|
|
121
|
-
case 'fetched':
|
|
122
|
-
icon = _outlineIcons.outlineIcons.src.icon_fetched;
|
|
123
|
-
listener = fetchedIconMouseDownListener;
|
|
124
|
-
alt = 'loaded';
|
|
125
|
-
break;
|
|
126
|
-
case 'failed':
|
|
127
|
-
icon = _outlineIcons.outlineIcons.src.icon_failed;
|
|
128
|
-
alt = 'failed';
|
|
129
|
-
listener = failedIconMouseDownListener;
|
|
130
|
-
break;
|
|
131
|
-
case 'unpermitted':
|
|
132
|
-
icon = _outlineIcons.outlineIcons.src.icon_failed;
|
|
133
|
-
listener = failedIconMouseDownListener;
|
|
134
|
-
alt = 'no perm';
|
|
135
|
-
break;
|
|
136
|
-
case 'unfetchable':
|
|
137
|
-
icon = _outlineIcons.outlineIcons.src.icon_failed;
|
|
138
|
-
listener = failedIconMouseDownListener;
|
|
139
|
-
alt = 'cannot fetch';
|
|
140
|
-
break;
|
|
141
|
-
default:
|
|
142
|
-
UI.log.error('?? state = ' + state);
|
|
143
|
-
break;
|
|
144
|
-
} // switch
|
|
145
|
-
var img = UI.utils.AJARImage(icon, alt, _outlineIcons.outlineIcons.tooltips[icon].replace(/[Tt]his resource/, docuri), dom);
|
|
146
|
-
img.setAttribute('uri', uri);
|
|
147
|
-
img.addEventListener('click', listener); // @@ seemed to be missing 2017-08
|
|
148
|
-
addButtonCallbacks(img, docuri);
|
|
149
|
-
node.appendChild(img);
|
|
150
|
-
return img;
|
|
151
|
-
}; // appendAccessIcon
|
|
152
|
-
|
|
153
|
-
/** make the td for an object (grammatical object)
|
|
154
|
-
* @param obj - an RDF term
|
|
155
|
-
* @param view - a VIEW function (rather than a bool asImage)
|
|
156
|
-
**/
|
|
157
|
-
|
|
158
|
-
this.outlineObjectTD = function outlineObjectTD(obj, view, deleteNode, statement) {
|
|
159
|
-
var td = dom.createElement('td');
|
|
160
|
-
td.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
|
|
161
|
-
td.setAttribute('notSelectable', 'false');
|
|
162
|
-
var theClass = 'obj';
|
|
163
|
-
|
|
164
|
-
// set about and put 'expand' icon
|
|
165
|
-
if (obj.termType === 'NamedNode' || obj.termType === 'BlankNode' || obj.termType === 'Literal' && obj.value.slice && (obj.value.slice(0, 6) === 'ftp://' || obj.value.slice(0, 8) === 'https://' || obj.value.slice(0, 7) === 'http://')) {
|
|
166
|
-
td.setAttribute('about', obj.toNT());
|
|
167
|
-
td.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-expand-trans.png', 'expand', undefined, dom)).addEventListener('click', expandMouseDownListener);
|
|
168
|
-
}
|
|
169
|
-
td.setAttribute('class', theClass); // this is how you find an object
|
|
170
|
-
// @@ TAKE CSS OUT OF STYLE SHEET
|
|
171
|
-
if (kb.whether(obj, UI.ns.rdf('type'), UI.ns.link('Request'))) {
|
|
172
|
-
td.className = 'undetermined';
|
|
173
|
-
} // @@? why-timbl
|
|
174
|
-
|
|
175
|
-
if (!view) {
|
|
176
|
-
// view should be a function pointer
|
|
177
|
-
view = viewAsBoringDefault;
|
|
178
|
-
}
|
|
179
|
-
td.appendChild(view(obj));
|
|
180
|
-
if (deleteNode) {
|
|
181
|
-
appendRemoveIcon(td, obj, deleteNode);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// set DOM methods
|
|
185
|
-
td.tabulatorSelect = function () {
|
|
186
|
-
setSelected(this, true);
|
|
187
|
-
};
|
|
188
|
-
td.tabulatorDeselect = function () {
|
|
189
|
-
setSelected(this, false);
|
|
190
|
-
};
|
|
191
|
-
td.addEventListener('click', selectableTDClickListener);
|
|
192
|
-
return td;
|
|
193
|
-
}; // outlineObjectTD
|
|
194
|
-
|
|
195
|
-
this.outlinePredicateTD = function outlinePredicateTD(predicate, newTr, inverse, internal) {
|
|
196
|
-
var predicateTD = dom.createElement('TD');
|
|
197
|
-
predicateTD.setAttribute('about', predicate.toNT());
|
|
198
|
-
predicateTD.setAttribute('class', internal ? 'pred internal' : 'pred');
|
|
199
|
-
var lab;
|
|
200
|
-
switch (predicate.termType) {
|
|
201
|
-
case 'BlankNode':
|
|
202
|
-
// TBD
|
|
203
|
-
predicateTD.className = 'undetermined';
|
|
204
|
-
break;
|
|
205
|
-
case 'NamedNode':
|
|
206
|
-
lab = UI.utils.predicateLabelForXML(predicate, inverse);
|
|
207
|
-
break;
|
|
208
|
-
case 'Collection':
|
|
209
|
-
// some choices of predicate
|
|
210
|
-
lab = UI.utils.predicateLabelForXML(predicate.elements[0], inverse);
|
|
211
|
-
}
|
|
212
|
-
lab = lab.slice(0, 1).toUpperCase() + lab.slice(1);
|
|
213
|
-
// if (kb.statementsMatching(predicate,rdf('type'), UI.ns.link('Request')).length) predicateTD.className='undetermined';
|
|
214
|
-
|
|
215
|
-
var labelTD = dom.createElement('TD');
|
|
216
|
-
labelTD.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
|
|
217
|
-
labelTD.setAttribute('notSelectable', 'true');
|
|
218
|
-
labelTD.appendChild(dom.createTextNode(lab));
|
|
219
|
-
predicateTD.appendChild(labelTD);
|
|
220
|
-
labelTD.style.width = '100%';
|
|
221
|
-
predicateTD.appendChild(termWidget.construct(dom)); // termWidget is global???
|
|
222
|
-
for (var w in _outlineIcons.outlineIcons.termWidgets) {
|
|
223
|
-
if (!newTr || !newTr.AJAR_statement) break; // case for TBD as predicate
|
|
224
|
-
// alert(Icon.termWidgets[w]+' '+Icon.termWidgets[w].filter)
|
|
225
|
-
if (_outlineIcons.outlineIcons.termWidgets[w].filter && _outlineIcons.outlineIcons.termWidgets[w].filter(newTr.AJAR_statement, 'pred', inverse)) {
|
|
226
|
-
termWidget.addIcon(predicateTD, _outlineIcons.outlineIcons.termWidgets[w]);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// set DOM methods
|
|
231
|
-
predicateTD.tabulatorSelect = function () {
|
|
232
|
-
setSelected(this, true);
|
|
233
|
-
};
|
|
234
|
-
predicateTD.tabulatorDeselect = function () {
|
|
235
|
-
setSelected(this, false);
|
|
236
|
-
};
|
|
237
|
-
predicateTD.addEventListener('click', selectableTDClickListener);
|
|
238
|
-
return predicateTD;
|
|
239
|
-
}; // outlinePredicateTD
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Render Tabbed set of home app panes
|
|
243
|
-
*
|
|
244
|
-
* @param {Object} [options] A set of options you can provide
|
|
245
|
-
* @param {string} [options.selectedTab] To open a specific dashboard pane
|
|
246
|
-
* @param {Function} [options.onClose] If given, will present an X for the dashboard, and call this method when clicked
|
|
247
|
-
* @returns Promise<{Element}> - the div that holds the dashboard
|
|
248
|
-
*/
|
|
249
|
-
function globalAppTabs() {
|
|
250
|
-
return _globalAppTabs.apply(this, arguments);
|
|
251
|
-
}
|
|
252
|
-
function _globalAppTabs() {
|
|
253
|
-
_globalAppTabs = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
254
|
-
var options,
|
|
255
|
-
div,
|
|
256
|
-
me,
|
|
257
|
-
items,
|
|
258
|
-
renderTab,
|
|
259
|
-
renderMain,
|
|
260
|
-
_args = arguments;
|
|
261
|
-
return _regenerator().w(function (_context) {
|
|
262
|
-
while (1) switch (_context.n) {
|
|
263
|
-
case 0:
|
|
264
|
-
renderMain = function _renderMain(containerDiv, item) {
|
|
265
|
-
// Items are pane names
|
|
266
|
-
var pane = paneRegistry.byName(item.paneName); // 20190701
|
|
267
|
-
containerDiv.innerHTML = '';
|
|
268
|
-
var table = containerDiv.appendChild(dom.createElement('table'));
|
|
269
|
-
var me = _solidLogic.authn.currentUser();
|
|
270
|
-
thisOutline.GotoSubject(item.subject || me, true, pane, false, undefined, table);
|
|
271
|
-
};
|
|
272
|
-
renderTab = function _renderTab(div, item) {
|
|
273
|
-
div.dataset.globalPaneName = item.tabName || item.paneName;
|
|
274
|
-
div.textContent = item.label;
|
|
275
|
-
};
|
|
276
|
-
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
277
|
-
console.log('globalAppTabs @@');
|
|
278
|
-
div = dom.createElement('div');
|
|
279
|
-
me = _solidLogic.authn.currentUser();
|
|
280
|
-
if (me) {
|
|
281
|
-
_context.n = 1;
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
alert('Must be logged in for this');
|
|
285
|
-
throw new Error('Not logged in');
|
|
286
|
-
case 1:
|
|
287
|
-
_context.n = 2;
|
|
288
|
-
return getDashboardItems();
|
|
289
|
-
case 2:
|
|
290
|
-
items = _context.v;
|
|
291
|
-
div.appendChild(UI.tabs.tabWidget({
|
|
292
|
-
dom: dom,
|
|
293
|
-
subject: me,
|
|
294
|
-
items: items,
|
|
295
|
-
renderMain: renderMain,
|
|
296
|
-
renderTab: renderTab,
|
|
297
|
-
ordered: true,
|
|
298
|
-
orientation: 0,
|
|
299
|
-
backgroundColor: '#eeeeee',
|
|
300
|
-
// black?
|
|
301
|
-
selectedTab: options.selectedTab,
|
|
302
|
-
onClose: options.onClose
|
|
303
|
-
}));
|
|
304
|
-
return _context.a(2, div);
|
|
305
|
-
}
|
|
306
|
-
}, _callee);
|
|
307
|
-
}));
|
|
308
|
-
return _globalAppTabs.apply(this, arguments);
|
|
309
|
-
}
|
|
310
|
-
this.getDashboard = globalAppTabs;
|
|
311
|
-
function getDashboardItems() {
|
|
312
|
-
return _getDashboardItems.apply(this, arguments);
|
|
313
|
-
}
|
|
314
|
-
function _getDashboardItems() {
|
|
315
|
-
_getDashboardItems = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
|
|
316
|
-
var me, div, _yield$Promise$all, _yield$Promise$all2, books, pods, getPods, _getPods, getAddressBooks, _getAddressBooks;
|
|
317
|
-
return _regenerator().w(function (_context8) {
|
|
318
|
-
while (1) switch (_context8.n) {
|
|
319
|
-
case 0:
|
|
320
|
-
_getAddressBooks = function _getAddressBooks3() {
|
|
321
|
-
_getAddressBooks = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
|
|
322
|
-
var _context6, _t3;
|
|
323
|
-
return _regenerator().w(function (_context7) {
|
|
324
|
-
while (1) switch (_context7.p = _context7.n) {
|
|
325
|
-
case 0:
|
|
326
|
-
_context7.p = 0;
|
|
327
|
-
_context7.n = 1;
|
|
328
|
-
return UI.login.findAppInstances({
|
|
329
|
-
me: me,
|
|
330
|
-
div: div,
|
|
331
|
-
dom: dom
|
|
332
|
-
}, ns.vcard('AddressBook'));
|
|
333
|
-
case 1:
|
|
334
|
-
_context6 = _context7.v;
|
|
335
|
-
return _context7.a(2, (_context6.instances || []).map(function (book, index) {
|
|
336
|
-
return {
|
|
337
|
-
paneName: 'contact',
|
|
338
|
-
tabName: "contact-".concat(index),
|
|
339
|
-
label: 'Contacts',
|
|
340
|
-
subject: book,
|
|
341
|
-
icon: UI.icons.iconBase + 'noun_15695.svg'
|
|
342
|
-
};
|
|
343
|
-
}));
|
|
344
|
-
case 2:
|
|
345
|
-
_context7.p = 2;
|
|
346
|
-
_t3 = _context7.v;
|
|
347
|
-
console.error('oops in globalAppTabs AddressBook');
|
|
348
|
-
return _context7.a(2, []);
|
|
349
|
-
}
|
|
350
|
-
}, _callee6, null, [[0, 2]]);
|
|
351
|
-
}));
|
|
352
|
-
return _getAddressBooks.apply(this, arguments);
|
|
353
|
-
};
|
|
354
|
-
getAddressBooks = function _getAddressBooks2() {
|
|
355
|
-
return _getAddressBooks.apply(this, arguments);
|
|
356
|
-
};
|
|
357
|
-
_getPods = function _getPods3() {
|
|
358
|
-
_getPods = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
359
|
-
var addPodStorage, _addPodStorage, addPodStorageFromUrl, _addPodStorageFromUrl, pods, uri, podUrl, uniques, _t, _t2;
|
|
360
|
-
return _regenerator().w(function (_context5) {
|
|
361
|
-
while (1) switch (_context5.p = _context5.n) {
|
|
362
|
-
case 0:
|
|
363
|
-
uniques = function _uniques(nodes) {
|
|
364
|
-
var uniqueNodes = [];
|
|
365
|
-
nodes.forEach(function (node) {
|
|
366
|
-
if (!uniqueNodes.find(function (uniqueNode) {
|
|
367
|
-
return uniqueNode.equals(node);
|
|
368
|
-
})) uniqueNodes.push(node);
|
|
369
|
-
});
|
|
370
|
-
return uniqueNodes;
|
|
371
|
-
};
|
|
372
|
-
_addPodStorageFromUrl = function _addPodStorageFromUrl3() {
|
|
373
|
-
_addPodStorageFromUrl = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(url) {
|
|
374
|
-
var podStorage, pathStorage;
|
|
375
|
-
return _regenerator().w(function (_context4) {
|
|
376
|
-
while (1) switch (_context4.n) {
|
|
377
|
-
case 0:
|
|
378
|
-
podStorage = new URL(url); // check for predicate pim:Storage in containers up the path tree
|
|
379
|
-
pathStorage = podStorage.pathname;
|
|
380
|
-
case 1:
|
|
381
|
-
if (!pathStorage.length) {
|
|
382
|
-
_context4.n = 4;
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
pathStorage = pathStorage.substring(0, pathStorage.lastIndexOf('/'));
|
|
386
|
-
_context4.n = 2;
|
|
387
|
-
return addPodStorage(kb.sym("".concat(podStorage.origin).concat(pathStorage, "/")));
|
|
388
|
-
case 2:
|
|
389
|
-
if (!_context4.v) {
|
|
390
|
-
_context4.n = 3;
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
return _context4.a(2);
|
|
394
|
-
case 3:
|
|
395
|
-
_context4.n = 1;
|
|
396
|
-
break;
|
|
397
|
-
case 4:
|
|
398
|
-
return _context4.a(2);
|
|
399
|
-
}
|
|
400
|
-
}, _callee4);
|
|
401
|
-
}));
|
|
402
|
-
return _addPodStorageFromUrl.apply(this, arguments);
|
|
403
|
-
};
|
|
404
|
-
addPodStorageFromUrl = function _addPodStorageFromUrl2(_x8) {
|
|
405
|
-
return _addPodStorageFromUrl.apply(this, arguments);
|
|
406
|
-
};
|
|
407
|
-
_addPodStorage = function _addPodStorage3() {
|
|
408
|
-
_addPodStorage = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(pod) {
|
|
409
|
-
return _regenerator().w(function (_context3) {
|
|
410
|
-
while (1) switch (_context3.n) {
|
|
411
|
-
case 0:
|
|
412
|
-
_context3.n = 1;
|
|
413
|
-
return loadContainerRepresentation(pod);
|
|
414
|
-
case 1:
|
|
415
|
-
if (!kb.holds(pod, ns.rdf('type'), ns.space('Storage'), pod.doc())) {
|
|
416
|
-
_context3.n = 2;
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
pods.push(pod);
|
|
420
|
-
return _context3.a(2, true);
|
|
421
|
-
case 2:
|
|
422
|
-
return _context3.a(2, false);
|
|
423
|
-
}
|
|
424
|
-
}, _callee3);
|
|
425
|
-
}));
|
|
426
|
-
return _addPodStorage.apply(this, arguments);
|
|
427
|
-
};
|
|
428
|
-
addPodStorage = function _addPodStorage2(_x7) {
|
|
429
|
-
return _addPodStorage.apply(this, arguments);
|
|
430
|
-
};
|
|
431
|
-
_context5.p = 1;
|
|
432
|
-
_context5.n = 2;
|
|
433
|
-
return kb.fetcher.load(me.doc());
|
|
434
|
-
case 2:
|
|
435
|
-
_context5.n = 4;
|
|
436
|
-
break;
|
|
437
|
-
case 3:
|
|
438
|
-
_context5.p = 3;
|
|
439
|
-
_t = _context5.v;
|
|
440
|
-
console.error('Unable to load profile', _t);
|
|
441
|
-
return _context5.a(2, []);
|
|
442
|
-
case 4:
|
|
443
|
-
// load pod's storages from profile
|
|
444
|
-
pods = kb.each(me, ns.space('storage'), null, me.doc());
|
|
445
|
-
pods.map(/*#__PURE__*/function () {
|
|
446
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(pod) {
|
|
447
|
-
return _regenerator().w(function (_context2) {
|
|
448
|
-
while (1) switch (_context2.n) {
|
|
449
|
-
case 0:
|
|
450
|
-
_context2.n = 1;
|
|
451
|
-
return loadContainerRepresentation(pod);
|
|
452
|
-
case 1:
|
|
453
|
-
return _context2.a(2);
|
|
454
|
-
}
|
|
455
|
-
}, _callee2);
|
|
456
|
-
}));
|
|
457
|
-
return function (_x9) {
|
|
458
|
-
return _ref.apply(this, arguments);
|
|
459
|
-
};
|
|
460
|
-
}());
|
|
461
|
-
_context5.p = 5;
|
|
462
|
-
// if uri then SolidOS is a browse.html web app
|
|
463
|
-
uri = new URL(window.location.href).searchParams.get('uri');
|
|
464
|
-
podUrl = uri || window.location.href;
|
|
465
|
-
_context5.n = 6;
|
|
466
|
-
return addPodStorageFromUrl(podUrl);
|
|
467
|
-
case 6:
|
|
468
|
-
_context5.n = 8;
|
|
469
|
-
break;
|
|
470
|
-
case 7:
|
|
471
|
-
_context5.p = 7;
|
|
472
|
-
_t2 = _context5.v;
|
|
473
|
-
console.error('cannot load container', _t2);
|
|
474
|
-
case 8:
|
|
475
|
-
pods = uniques(pods);
|
|
476
|
-
if (pods.length) {
|
|
477
|
-
_context5.n = 9;
|
|
478
|
-
break;
|
|
479
|
-
}
|
|
480
|
-
return _context5.a(2, []);
|
|
481
|
-
case 9:
|
|
482
|
-
return _context5.a(2, pods.map(function (pod, index) {
|
|
483
|
-
function split(item) {
|
|
484
|
-
return item.uri.split('//')[1].slice(0, -1);
|
|
485
|
-
}
|
|
486
|
-
var label = split(me).startsWith(split(pod)) ? 'Your storage' : split(pod);
|
|
487
|
-
return {
|
|
488
|
-
paneName: 'folder',
|
|
489
|
-
tabName: "folder-".concat(index),
|
|
490
|
-
label: label,
|
|
491
|
-
subject: pod,
|
|
492
|
-
icon: UI.icons.iconBase + 'noun_Cabinet_251723.svg'
|
|
493
|
-
};
|
|
494
|
-
}));
|
|
495
|
-
}
|
|
496
|
-
}, _callee5, null, [[5, 7], [1, 3]]);
|
|
497
|
-
}));
|
|
498
|
-
return _getPods.apply(this, arguments);
|
|
499
|
-
};
|
|
500
|
-
getPods = function _getPods2() {
|
|
501
|
-
return _getPods.apply(this, arguments);
|
|
502
|
-
};
|
|
503
|
-
me = _solidLogic.authn.currentUser();
|
|
504
|
-
if (me) {
|
|
505
|
-
_context8.n = 1;
|
|
506
|
-
break;
|
|
507
|
-
}
|
|
508
|
-
return _context8.a(2, []);
|
|
509
|
-
case 1:
|
|
510
|
-
div = dom.createElement('div');
|
|
511
|
-
_context8.n = 2;
|
|
512
|
-
return Promise.all([getAddressBooks(), getPods()]);
|
|
513
|
-
case 2:
|
|
514
|
-
_yield$Promise$all = _context8.v;
|
|
515
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
516
|
-
books = _yield$Promise$all2[0];
|
|
517
|
-
pods = _yield$Promise$all2[1];
|
|
518
|
-
return _context8.a(2, [{
|
|
519
|
-
paneName: 'home',
|
|
520
|
-
label: 'Your stuff',
|
|
521
|
-
icon: UI.icons.iconBase + 'noun_547570.svg'
|
|
522
|
-
}, {
|
|
523
|
-
paneName: 'basicPreferences',
|
|
524
|
-
label: 'Preferences',
|
|
525
|
-
icon: UI.icons.iconBase + 'noun_Sliders_341315_00000.svg'
|
|
526
|
-
}, {
|
|
527
|
-
paneName: 'profile',
|
|
528
|
-
label: 'Your Profile',
|
|
529
|
-
icon: UI.icons.iconBase + 'noun_15059.svg'
|
|
530
|
-
}, {
|
|
531
|
-
paneName: 'editProfile',
|
|
532
|
-
label: 'Edit your Profile',
|
|
533
|
-
icon: UI.icons.iconBase + 'noun_492246.svg'
|
|
534
|
-
}].concat(books).concat(pods));
|
|
535
|
-
}
|
|
536
|
-
}, _callee7);
|
|
537
|
-
}));
|
|
538
|
-
return _getDashboardItems.apply(this, arguments);
|
|
539
|
-
}
|
|
540
|
-
this.getDashboardItems = getDashboardItems;
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* Call this method to show the global dashboard.
|
|
544
|
-
*
|
|
545
|
-
* @param {Object} [options] A set of options that can be passed
|
|
546
|
-
* @param {string} [options.pane] To open a specific dashboard pane
|
|
547
|
-
* @returns {Promise<void>}
|
|
548
|
-
*/
|
|
549
|
-
function showDashboard() {
|
|
550
|
-
return _showDashboard.apply(this, arguments);
|
|
551
|
-
}
|
|
552
|
-
function _showDashboard() {
|
|
553
|
-
_showDashboard = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
554
|
-
var options,
|
|
555
|
-
dashboardContainer,
|
|
556
|
-
outlineContainer,
|
|
557
|
-
_tab,
|
|
558
|
-
dashboard,
|
|
559
|
-
tab,
|
|
560
|
-
closeDashboard,
|
|
561
|
-
_args8 = arguments;
|
|
562
|
-
return _regenerator().w(function (_context9) {
|
|
563
|
-
while (1) switch (_context9.n) {
|
|
564
|
-
case 0:
|
|
565
|
-
closeDashboard = function _closeDashboard() {
|
|
566
|
-
dashboardContainer.style.display = 'none';
|
|
567
|
-
outlineContainer.style.display = 'inherit';
|
|
568
|
-
};
|
|
569
|
-
options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
570
|
-
dashboardContainer = getDashboardContainer();
|
|
571
|
-
outlineContainer = getOutlineContainer(); // reuse dashboard if already children already is inserted
|
|
572
|
-
if (!(dashboardContainer.childNodes.length > 0 && options.pane)) {
|
|
573
|
-
_context9.n = 2;
|
|
574
|
-
break;
|
|
575
|
-
}
|
|
576
|
-
outlineContainer.style.display = 'none';
|
|
577
|
-
dashboardContainer.style.display = 'inherit';
|
|
578
|
-
_tab = dashboardContainer.querySelector("[data-global-pane-name=\"".concat(options.pane, "\"]"));
|
|
579
|
-
if (!_tab) {
|
|
580
|
-
_context9.n = 1;
|
|
581
|
-
break;
|
|
582
|
-
}
|
|
583
|
-
_tab.click();
|
|
584
|
-
return _context9.a(2);
|
|
585
|
-
case 1:
|
|
586
|
-
console.warn('Did not find the referred tab in global dashboard, will open first one');
|
|
587
|
-
case 2:
|
|
588
|
-
_context9.n = 3;
|
|
589
|
-
return globalAppTabs({
|
|
590
|
-
selectedTab: options.pane,
|
|
591
|
-
onClose: closeDashboard
|
|
592
|
-
});
|
|
593
|
-
case 3:
|
|
594
|
-
dashboard = _context9.v;
|
|
595
|
-
// close the dashboard if user log out
|
|
596
|
-
_solidLogic.authSession.events.on("logout", closeDashboard);
|
|
597
|
-
|
|
598
|
-
// finally - switch to showing dashboard
|
|
599
|
-
outlineContainer.style.display = 'none';
|
|
600
|
-
dashboardContainer.appendChild(dashboard);
|
|
601
|
-
tab = dashboardContainer.querySelector("[data-global-pane-name=\"".concat(options.pane, "\"]"));
|
|
602
|
-
if (tab) {
|
|
603
|
-
tab.click();
|
|
604
|
-
}
|
|
605
|
-
case 4:
|
|
606
|
-
return _context9.a(2);
|
|
607
|
-
}
|
|
608
|
-
}, _callee8);
|
|
609
|
-
}));
|
|
610
|
-
return _showDashboard.apply(this, arguments);
|
|
611
|
-
}
|
|
612
|
-
this.showDashboard = showDashboard;
|
|
613
|
-
function getDashboardContainer() {
|
|
614
|
-
return getOrCreateContainer('GlobalDashboard');
|
|
615
|
-
}
|
|
616
|
-
function getOutlineContainer() {
|
|
617
|
-
return getOrCreateContainer('outline');
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
/**
|
|
621
|
-
* Get element with id or create a new on the fly with that id
|
|
622
|
-
*
|
|
623
|
-
* @param {string} id The ID of the element you want to get or create
|
|
624
|
-
* @returns {HTMLElement}
|
|
625
|
-
*/
|
|
626
|
-
function getOrCreateContainer(id) {
|
|
627
|
-
return document.getElementById(id) || function () {
|
|
628
|
-
var dashboardContainer = document.createElement('div');
|
|
629
|
-
dashboardContainer.id = id;
|
|
630
|
-
var mainContainer = document.querySelector('[role="main"]') || document.body;
|
|
631
|
-
return mainContainer.appendChild(dashboardContainer);
|
|
632
|
-
}();
|
|
633
|
-
}
|
|
634
|
-
function loadContainerRepresentation(_x) {
|
|
635
|
-
return _loadContainerRepresentation.apply(this, arguments);
|
|
636
|
-
}
|
|
637
|
-
function _loadContainerRepresentation() {
|
|
638
|
-
_loadContainerRepresentation = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(subject) {
|
|
639
|
-
var response, containerTurtle;
|
|
640
|
-
return _regenerator().w(function (_context0) {
|
|
641
|
-
while (1) switch (_context0.n) {
|
|
642
|
-
case 0:
|
|
643
|
-
if (kb.any(subject, ns.ldp('contains'), undefined, subject.doc())) {
|
|
644
|
-
_context0.n = 2;
|
|
645
|
-
break;
|
|
646
|
-
}
|
|
647
|
-
_context0.n = 1;
|
|
648
|
-
return kb.fetcher.webOperation('GET', subject.uri, kb.fetcher.initFetchOptions(subject.uri, {
|
|
649
|
-
headers: {
|
|
650
|
-
accept: 'text/turtle'
|
|
651
|
-
}
|
|
652
|
-
}));
|
|
653
|
-
case 1:
|
|
654
|
-
response = _context0.v;
|
|
655
|
-
containerTurtle = response.responseText;
|
|
656
|
-
$rdf.parse(containerTurtle, kb, subject.uri, 'text/turtle');
|
|
657
|
-
case 2:
|
|
658
|
-
return _context0.a(2);
|
|
659
|
-
}
|
|
660
|
-
}, _callee9);
|
|
661
|
-
}));
|
|
662
|
-
return _loadContainerRepresentation.apply(this, arguments);
|
|
663
|
-
}
|
|
664
|
-
function getRelevantPanes(_x2, _x3) {
|
|
665
|
-
return _getRelevantPanes.apply(this, arguments);
|
|
666
|
-
}
|
|
667
|
-
function _getRelevantPanes() {
|
|
668
|
-
_getRelevantPanes = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(subject, context) {
|
|
669
|
-
var panes, relevantPanes, filteredPanes, firstRelevantPaneIndex, firstFilteredPaneIndex;
|
|
670
|
-
return _regenerator().w(function (_context1) {
|
|
671
|
-
while (1) switch (_context1.n) {
|
|
672
|
-
case 0:
|
|
673
|
-
if (!subject.uri.endsWith('/')) {
|
|
674
|
-
_context1.n = 1;
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
_context1.n = 1;
|
|
678
|
-
return loadContainerRepresentation(subject);
|
|
679
|
-
case 1:
|
|
680
|
-
panes = context.session.paneRegistry;
|
|
681
|
-
relevantPanes = panes.list.filter(function (pane) {
|
|
682
|
-
return pane.label(subject, context) && !pane.global;
|
|
683
|
-
});
|
|
684
|
-
if (!(relevantPanes.length === 0)) {
|
|
685
|
-
_context1.n = 2;
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
return _context1.a(2, [panes.byName('internal')]);
|
|
689
|
-
case 2:
|
|
690
|
-
_context1.n = 3;
|
|
691
|
-
return UI.login.filterAvailablePanes(relevantPanes);
|
|
692
|
-
case 3:
|
|
693
|
-
filteredPanes = _context1.v;
|
|
694
|
-
if (!(filteredPanes.length === 0)) {
|
|
695
|
-
_context1.n = 4;
|
|
696
|
-
break;
|
|
697
|
-
}
|
|
698
|
-
return _context1.a(2, [relevantPanes[0]]);
|
|
699
|
-
case 4:
|
|
700
|
-
firstRelevantPaneIndex = panes.list.indexOf(relevantPanes[0]);
|
|
701
|
-
firstFilteredPaneIndex = panes.list.indexOf(filteredPanes[0]); // if the first relevant pane is loaded before the panes available wrt role, we still want to offer the most relevant pane
|
|
702
|
-
return _context1.a(2, firstRelevantPaneIndex < firstFilteredPaneIndex ? [relevantPanes[0]].concat(filteredPanes) : filteredPanes);
|
|
703
|
-
}
|
|
704
|
-
}, _callee0);
|
|
705
|
-
}));
|
|
706
|
-
return _getRelevantPanes.apply(this, arguments);
|
|
707
|
-
}
|
|
708
|
-
function getPane(relevantPanes, subject) {
|
|
709
|
-
return relevantPanes.find(function (pane) {
|
|
710
|
-
return pane.shouldGetFocus && pane.shouldGetFocus(subject);
|
|
711
|
-
}) || relevantPanes[0];
|
|
712
|
-
}
|
|
713
|
-
function expandedHeaderTR(_x4, _x5, _x6) {
|
|
714
|
-
return _expandedHeaderTR.apply(this, arguments);
|
|
715
|
-
} // expandedHeaderTR
|
|
716
|
-
// / //////////////////////////////////////////////////////////////////////////
|
|
717
|
-
/* PANES
|
|
718
|
-
**
|
|
719
|
-
** Panes are regions of the outline view in which a particular subject is
|
|
720
|
-
** displayed in a particular way. They are like views but views are for query results.
|
|
721
|
-
** subject panes are currently stacked vertically.
|
|
722
|
-
*/
|
|
723
|
-
// / //////////////////// Specific panes are in panes/*.js
|
|
724
|
-
//
|
|
725
|
-
// The defaultPane is the first one registered for which the label method exists
|
|
726
|
-
// Those registered first take priority as a default pane.
|
|
727
|
-
// That is, those earlier in this file
|
|
728
|
-
/**
|
|
729
|
-
* Pane registration
|
|
730
|
-
*/
|
|
731
|
-
// the second argument indicates whether the query button is required
|
|
732
|
-
// / ///////////////////////////////////////////////////////////////////////////
|
|
733
|
-
// Remove a node from the DOM so that Firefox refreshes the screen OK
|
|
734
|
-
// Just deleting it cause whitespace to accumulate.
|
|
735
|
-
function _expandedHeaderTR() {
|
|
736
|
-
_expandedHeaderTR = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10(subject, requiredPane, options) {
|
|
737
|
-
var renderPaneIconTray, _renderPaneIconTray, tr, td, header, showHeader, icon, strong, _t5;
|
|
738
|
-
return _regenerator().w(function (_context11) {
|
|
739
|
-
while (1) switch (_context11.n) {
|
|
740
|
-
case 0:
|
|
741
|
-
_renderPaneIconTray = function _renderPaneIconTray3() {
|
|
742
|
-
_renderPaneIconTray = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(td) {
|
|
743
|
-
var options,
|
|
744
|
-
paneShownStyle,
|
|
745
|
-
paneHiddenStyle,
|
|
746
|
-
paneIconTray,
|
|
747
|
-
relevantPanes,
|
|
748
|
-
paneNumber,
|
|
749
|
-
_args1 = arguments,
|
|
750
|
-
_t4;
|
|
751
|
-
return _regenerator().w(function (_context10) {
|
|
752
|
-
while (1) switch (_context10.n) {
|
|
753
|
-
case 0:
|
|
754
|
-
options = _args1.length > 1 && _args1[1] !== undefined ? _args1[1] : {};
|
|
755
|
-
paneShownStyle = 'width: 24px; border-radius: 0.5em; border-top: solid #222 1px; border-left: solid #222 0.1em; border-bottom: solid #eee 0.1em; border-right: solid #eee 0.1em; margin-left: 1em; padding: 3px; background-color: #ffd;';
|
|
756
|
-
paneHiddenStyle = 'width: 24px; border-radius: 0.5em; margin-left: 1em; padding: 3px';
|
|
757
|
-
paneIconTray = td.appendChild(dom.createElement('nav'));
|
|
758
|
-
paneIconTray.style = 'display:flex; justify-content: flex-start; align-items: center;';
|
|
759
|
-
if (!options.hideList) {
|
|
760
|
-
_context10.n = 1;
|
|
761
|
-
break;
|
|
762
|
-
}
|
|
763
|
-
_t4 = [];
|
|
764
|
-
_context10.n = 3;
|
|
765
|
-
break;
|
|
766
|
-
case 1:
|
|
767
|
-
_context10.n = 2;
|
|
768
|
-
return getRelevantPanes(subject, context);
|
|
769
|
-
case 2:
|
|
770
|
-
_t4 = _context10.v;
|
|
771
|
-
case 3:
|
|
772
|
-
relevantPanes = _t4;
|
|
773
|
-
tr.firstPane = requiredPane || getPane(relevantPanes, subject);
|
|
774
|
-
paneNumber = relevantPanes.indexOf(tr.firstPane);
|
|
775
|
-
if (relevantPanes.length !== 1) {
|
|
776
|
-
// if only one, simplify interface
|
|
777
|
-
relevantPanes.forEach(function (pane, index) {
|
|
778
|
-
var label = pane.label(subject, context);
|
|
779
|
-
var ico = UI.utils.AJARImage(pane.icon, label, label, dom);
|
|
780
|
-
ico.style = pane === tr.firstPane ? paneShownStyle : paneHiddenStyle; // init to something at least
|
|
781
|
-
// ico.setAttribute('align','right'); @@ Should be better, but ffox bug pushes them down
|
|
782
|
-
// ico.style.width = iconHeight
|
|
783
|
-
// ico.style.height = iconHeight
|
|
784
|
-
var listen = function listen(ico, pane) {
|
|
785
|
-
// Freeze scope for event time
|
|
786
|
-
ico.addEventListener('click', function (event) {
|
|
787
|
-
var containingTable;
|
|
788
|
-
// Find the containing table for this subject
|
|
789
|
-
for (containingTable = td; containingTable.parentNode; containingTable = containingTable.parentNode) {
|
|
790
|
-
if (containingTable.nodeName === 'TABLE') break;
|
|
791
|
-
}
|
|
792
|
-
if (containingTable.nodeName !== 'TABLE') {
|
|
793
|
-
throw new Error('outline: internal error.');
|
|
794
|
-
}
|
|
795
|
-
var removePanes = function removePanes(specific) {
|
|
796
|
-
for (var d = containingTable.firstChild; d; d = d.nextSibling) {
|
|
797
|
-
if (typeof d.pane !== 'undefined') {
|
|
798
|
-
if (!specific || d.pane === specific) {
|
|
799
|
-
if (d.paneButton) {
|
|
800
|
-
d.paneButton.setAttribute('class', 'paneHidden');
|
|
801
|
-
d.paneButton.style = paneHiddenStyle;
|
|
802
|
-
}
|
|
803
|
-
removeAndRefresh(d);
|
|
804
|
-
// If we just delete the node d, ffox doesn't refresh the display properly.
|
|
805
|
-
// state = 'paneHidden';
|
|
806
|
-
if (d.pane.requireQueryButton && containingTable.parentNode.className /* outer table */ && numberOfPanesRequiringQueryButton === 1 && dom.getElementById('queryButton')) {
|
|
807
|
-
dom.getElementById('queryButton').setAttribute('style', 'display:none;');
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
};
|
|
813
|
-
var renderPane = function renderPane(pane) {
|
|
814
|
-
var paneDiv;
|
|
815
|
-
UI.log.info('outline: Rendering pane (2): ' + pane.name);
|
|
816
|
-
try {
|
|
817
|
-
paneDiv = pane.render(subject, context, options);
|
|
818
|
-
} catch (e) {
|
|
819
|
-
// Easier debugging for pane developers
|
|
820
|
-
paneDiv = dom.createElement('div');
|
|
821
|
-
paneDiv.setAttribute('class', 'exceptionPane');
|
|
822
|
-
var pre = dom.createElement('pre');
|
|
823
|
-
paneDiv.appendChild(pre);
|
|
824
|
-
pre.appendChild(dom.createTextNode(UI.utils.stackString(e)));
|
|
825
|
-
}
|
|
826
|
-
if (pane.requireQueryButton && dom.getElementById('queryButton')) {
|
|
827
|
-
dom.getElementById('queryButton').removeAttribute('style');
|
|
828
|
-
}
|
|
829
|
-
var second = containingTable.firstChild.nextSibling;
|
|
830
|
-
var row = dom.createElement('tr');
|
|
831
|
-
var cell = row.appendChild(dom.createElement('td'));
|
|
832
|
-
cell.appendChild(paneDiv);
|
|
833
|
-
if (second) containingTable.insertBefore(row, second);else containingTable.appendChild(row);
|
|
834
|
-
row.pane = pane;
|
|
835
|
-
row.paneButton = ico;
|
|
836
|
-
};
|
|
837
|
-
var state = ico.getAttribute('class');
|
|
838
|
-
if (state === 'paneHidden') {
|
|
839
|
-
if (!event.shiftKey) {
|
|
840
|
-
// shift means multiple select
|
|
841
|
-
removePanes();
|
|
842
|
-
}
|
|
843
|
-
renderPane(pane);
|
|
844
|
-
ico.setAttribute('class', 'paneShown');
|
|
845
|
-
ico.style = paneShownStyle;
|
|
846
|
-
} else {
|
|
847
|
-
removePanes(pane);
|
|
848
|
-
ico.setAttribute('class', 'paneHidden');
|
|
849
|
-
ico.style = paneHiddenStyle;
|
|
850
|
-
}
|
|
851
|
-
var numberOfPanesRequiringQueryButton = 0;
|
|
852
|
-
for (var d = containingTable.firstChild; d; d = d.nextSibling) {
|
|
853
|
-
if (d.pane && d.pane.requireQueryButton) {
|
|
854
|
-
numberOfPanesRequiringQueryButton++;
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}, false);
|
|
858
|
-
}; // listen
|
|
859
|
-
|
|
860
|
-
listen(ico, pane);
|
|
861
|
-
ico.setAttribute('class', index !== paneNumber ? 'paneHidden' : 'paneShown');
|
|
862
|
-
if (index === paneNumber) tr.paneButton = ico;
|
|
863
|
-
paneIconTray.appendChild(ico);
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
return _context10.a(2, paneIconTray);
|
|
867
|
-
}
|
|
868
|
-
}, _callee1);
|
|
869
|
-
}));
|
|
870
|
-
return _renderPaneIconTray.apply(this, arguments);
|
|
871
|
-
};
|
|
872
|
-
renderPaneIconTray = function _renderPaneIconTray2(_x0) {
|
|
873
|
-
return _renderPaneIconTray.apply(this, arguments);
|
|
874
|
-
}; // renderPaneIconTray
|
|
875
|
-
// Body of expandedHeaderTR
|
|
876
|
-
tr = dom.createElement('tr');
|
|
877
|
-
if (options.hover) {
|
|
878
|
-
// By default no hide till hover as community deems it confusing
|
|
879
|
-
tr.setAttribute('class', 'hoverControl');
|
|
880
|
-
}
|
|
881
|
-
td = tr.appendChild(dom.createElement('td'));
|
|
882
|
-
td.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;' + 'display:flex; justify-content: space-between; flex-direction: row;');
|
|
883
|
-
td.setAttribute('notSelectable', 'true');
|
|
884
|
-
td.setAttribute('about', subject.toNT());
|
|
885
|
-
td.setAttribute('colspan', '2');
|
|
886
|
-
|
|
887
|
-
// Stuff at the right about the subject
|
|
888
|
-
header = td.appendChild(dom.createElement('div'));
|
|
889
|
-
header.style = 'display:flex; justify-content: flex-start; align-items: center; flex-wrap: wrap;';
|
|
890
|
-
showHeader = !!requiredPane;
|
|
891
|
-
if (!options.solo && !showHeader) {
|
|
892
|
-
icon = header.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-collapse.png', 'collapse', undefined, dom));
|
|
893
|
-
icon.addEventListener('click', collapseMouseDownListener);
|
|
894
|
-
strong = header.appendChild(dom.createElement('h1'));
|
|
895
|
-
strong.appendChild(dom.createTextNode(UI.utils.label(subject)));
|
|
896
|
-
strong.style = 'font-size: 150%; margin: 0 0.6em 0 0; padding: 0.1em 0.4em;';
|
|
897
|
-
UI.widgets.makeDraggable(strong, subject);
|
|
898
|
-
}
|
|
899
|
-
_t5 = header;
|
|
900
|
-
_context11.n = 1;
|
|
901
|
-
return renderPaneIconTray(td, {
|
|
902
|
-
hideList: showHeader
|
|
903
|
-
});
|
|
904
|
-
case 1:
|
|
905
|
-
_t5.appendChild.call(_t5, _context11.v);
|
|
906
|
-
// set DOM methods
|
|
907
|
-
tr.firstChild.tabulatorSelect = function () {
|
|
908
|
-
setSelected(this, true);
|
|
909
|
-
};
|
|
910
|
-
tr.firstChild.tabulatorDeselect = function () {
|
|
911
|
-
setSelected(this, false);
|
|
912
|
-
};
|
|
913
|
-
return _context11.a(2, tr);
|
|
914
|
-
}
|
|
915
|
-
}, _callee10);
|
|
916
|
-
}));
|
|
917
|
-
return _expandedHeaderTR.apply(this, arguments);
|
|
918
|
-
}
|
|
919
|
-
function removeAndRefresh(d) {
|
|
920
|
-
var table = d.parentNode;
|
|
921
|
-
var par = table.parentNode;
|
|
922
|
-
var placeholder = dom.createElement('table');
|
|
923
|
-
placeholder.setAttribute('style', 'width: 100%;');
|
|
924
|
-
par.replaceChild(placeholder, table);
|
|
925
|
-
table.removeChild(d);
|
|
926
|
-
par.replaceChild(table, placeholder); // Attempt to
|
|
927
|
-
}
|
|
928
|
-
var propertyTable = this.propertyTable = function propertyTable(subject, table, pane, options) {
|
|
929
|
-
UI.log.debug('Property table for: ' + subject);
|
|
930
|
-
subject = kb.canon(subject);
|
|
931
|
-
// if (!pane) pane = panes.defaultPane;
|
|
932
|
-
|
|
933
|
-
if (!table) {
|
|
934
|
-
// Create a new property table
|
|
935
|
-
table = dom.createElement('table');
|
|
936
|
-
table.setAttribute('style', 'width: 100%;');
|
|
937
|
-
expandedHeaderTR(subject, pane, options).then(function (tr1) {
|
|
938
|
-
table.appendChild(tr1);
|
|
939
|
-
if (tr1.firstPane) {
|
|
940
|
-
var paneDiv;
|
|
941
|
-
try {
|
|
942
|
-
UI.log.info('outline: Rendering pane (1): ' + tr1.firstPane.name);
|
|
943
|
-
paneDiv = tr1.firstPane.render(subject, context, options);
|
|
944
|
-
} catch (e) {
|
|
945
|
-
// Easier debugging for pane developers
|
|
946
|
-
paneDiv = dom.createElement('div');
|
|
947
|
-
paneDiv.setAttribute('class', 'exceptionPane');
|
|
948
|
-
var pre = dom.createElement('pre');
|
|
949
|
-
paneDiv.appendChild(pre);
|
|
950
|
-
pre.appendChild(dom.createTextNode(UI.utils.stackString(e)));
|
|
951
|
-
}
|
|
952
|
-
var row = dom.createElement('tr');
|
|
953
|
-
var cell = row.appendChild(dom.createElement('td'));
|
|
954
|
-
cell.appendChild(paneDiv);
|
|
955
|
-
if (tr1.firstPane.requireQueryButton && dom.getElementById('queryButton')) {
|
|
956
|
-
dom.getElementById('queryButton').removeAttribute('style');
|
|
957
|
-
}
|
|
958
|
-
table.appendChild(row);
|
|
959
|
-
row.pane = tr1.firstPane;
|
|
960
|
-
row.paneButton = tr1.paneButton;
|
|
961
|
-
}
|
|
962
|
-
});
|
|
963
|
-
return table;
|
|
964
|
-
} else {
|
|
965
|
-
// New display of existing table, keeping expanded bits
|
|
966
|
-
UI.log.info('Re-expand: ' + table);
|
|
967
|
-
// do some other stuff here
|
|
968
|
-
return table;
|
|
969
|
-
}
|
|
970
|
-
}; /* propertyTable */
|
|
971
|
-
|
|
972
|
-
function propertyTR(doc, st, inverse) {
|
|
973
|
-
var tr = doc.createElement('TR');
|
|
974
|
-
tr.AJAR_statement = st;
|
|
975
|
-
tr.AJAR_inverse = inverse;
|
|
976
|
-
// tr.AJAR_variable = null; // @@ ?? was just 'tr.AJAR_variable'
|
|
977
|
-
tr.setAttribute('predTR', 'true');
|
|
978
|
-
var predicateTD = thisOutline.outlinePredicateTD(st.predicate, tr, inverse);
|
|
979
|
-
tr.appendChild(predicateTD); // @@ add 'internal' to predicateTD's class for style? mno
|
|
980
|
-
return tr;
|
|
981
|
-
}
|
|
982
|
-
this.propertyTR = propertyTR;
|
|
983
|
-
|
|
984
|
-
// / ////////// Property list
|
|
985
|
-
function appendPropertyTRs(parent, plist, inverse, predicateFilter) {
|
|
986
|
-
// UI.log.info('@appendPropertyTRs, 'this' is %s, dom is %s, '+ // Gives 'can't access dead object'
|
|
987
|
-
// 'thisOutline.document is %s', this, dom.location, thisOutline.document.location);
|
|
988
|
-
// UI.log.info('@appendPropertyTRs, dom is now ' + this.document.location);
|
|
989
|
-
// UI.log.info('@appendPropertyTRs, dom is now ' + thisOutline.document.location);
|
|
990
|
-
UI.log.debug('Property list length = ' + plist.length);
|
|
991
|
-
if (plist.length === 0) return '';
|
|
992
|
-
var sel, j, k;
|
|
993
|
-
if (inverse) {
|
|
994
|
-
sel = function sel(x) {
|
|
995
|
-
return x.subject;
|
|
996
|
-
};
|
|
997
|
-
plist = plist.sort(UI.utils.RDFComparePredicateSubject);
|
|
998
|
-
} else {
|
|
999
|
-
sel = function sel(x) {
|
|
1000
|
-
return x.object;
|
|
1001
|
-
};
|
|
1002
|
-
plist = plist.sort(UI.utils.RDFComparePredicateObject);
|
|
1003
|
-
}
|
|
1004
|
-
var max = plist.length;
|
|
1005
|
-
var _loop = function _loop() {
|
|
1006
|
-
// squishing together equivalent properties I think
|
|
1007
|
-
var s = plist[j];
|
|
1008
|
-
// if (s.object == parentSubject) continue; // that we knew
|
|
1009
|
-
|
|
1010
|
-
// Avoid predicates from other panes
|
|
1011
|
-
if (predicateFilter && !predicateFilter(s.predicate, inverse)) return 0; // continue
|
|
1012
|
-
var tr = propertyTR(dom, s, inverse);
|
|
1013
|
-
parent.appendChild(tr);
|
|
1014
|
-
var predicateTD = tr.firstChild; // we need to kludge the rowspan later
|
|
1015
|
-
|
|
1016
|
-
var defaultpropview = views.defaults[s.predicate.uri];
|
|
1017
|
-
|
|
1018
|
-
// LANGUAGE PREFERENCES WAS AVAILABLE WITH FF EXTENSION - get from elsewhere?
|
|
1019
|
-
|
|
1020
|
-
var dups = 0; // How many rows have the same predicate, -1?
|
|
1021
|
-
var langTagged = 0; // how many objects have language tags?
|
|
1022
|
-
var myLang = 0; // Is there one I like?
|
|
1023
|
-
|
|
1024
|
-
for (k = 0; k + j < max && plist[j + k].predicate.sameTerm(s.predicate); k++) {
|
|
1025
|
-
if (k > 0 && sel(plist[j + k]).sameTerm(sel(plist[j + k - 1]))) dups++;
|
|
1026
|
-
if (sel(plist[j + k]).lang && outline.labeller.LanguagePreference) {
|
|
1027
|
-
langTagged += 1;
|
|
1028
|
-
if (sel(plist[j + k]).lang.indexOf(outline.labeller.LanguagePreference) >= 0) {
|
|
1029
|
-
myLang++;
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
/* Display only the one in the preferred language
|
|
1035
|
-
ONLY in the case (currently) when all the values are tagged.
|
|
1036
|
-
Then we treat them as alternatives. */
|
|
1037
|
-
|
|
1038
|
-
if (myLang > 0 && langTagged === dups + 1) {
|
|
1039
|
-
for (var _k = j; _k <= j + dups; _k++) {
|
|
1040
|
-
if (outline.labeller.LanguagePreference && sel(plist[_k]).lang.indexOf(outline.labeller.LanguagePreference) >= 0) {
|
|
1041
|
-
tr.appendChild(thisOutline.outlineObjectTD(sel(plist[_k]), defaultpropview, undefined, s));
|
|
1042
|
-
break;
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
j += dups; // extra push
|
|
1046
|
-
return 0; // continue
|
|
1047
|
-
}
|
|
1048
|
-
tr.appendChild(thisOutline.outlineObjectTD(sel(s), defaultpropview, undefined, s));
|
|
1049
|
-
|
|
1050
|
-
/* Note: showNobj shows between n to 2n objects.
|
|
1051
|
-
* This is to prevent the case where you have a long list of objects
|
|
1052
|
-
* shown, and dangling at the end is '1 more' (which is easily ignored)
|
|
1053
|
-
* Therefore more objects are shown than hidden.
|
|
1054
|
-
*/
|
|
1055
|
-
|
|
1056
|
-
tr.showNobj = function (n) {
|
|
1057
|
-
var predDups = k - dups;
|
|
1058
|
-
var show = 2 * n < predDups ? n : predDups;
|
|
1059
|
-
var showLaterArray = [];
|
|
1060
|
-
if (predDups !== 1) {
|
|
1061
|
-
predicateTD.setAttribute('rowspan', show === predDups ? predDups : n + 1);
|
|
1062
|
-
var l;
|
|
1063
|
-
if (show < predDups && show === 1) {
|
|
1064
|
-
// what case is this...
|
|
1065
|
-
predicateTD.setAttribute('rowspan', 2);
|
|
1066
|
-
}
|
|
1067
|
-
var displayed = 0; // The number of cells generated-1,
|
|
1068
|
-
// all duplicate thing removed
|
|
1069
|
-
for (l = 1; l < k; l++) {
|
|
1070
|
-
// This detects the same things
|
|
1071
|
-
if (!kb.canon(sel(plist[j + l])).sameTerm(kb.canon(sel(plist[j + l - 1])))) {
|
|
1072
|
-
displayed++;
|
|
1073
|
-
s = plist[j + l];
|
|
1074
|
-
defaultpropview = views.defaults[s.predicate.uri];
|
|
1075
|
-
var trObj = dom.createElement('tr');
|
|
1076
|
-
trObj.style.colspan = '1';
|
|
1077
|
-
trObj.appendChild(thisOutline.outlineObjectTD(sel(plist[j + l]), defaultpropview, undefined, s));
|
|
1078
|
-
trObj.AJAR_statement = s;
|
|
1079
|
-
trObj.AJAR_inverse = inverse;
|
|
1080
|
-
parent.appendChild(trObj);
|
|
1081
|
-
if (displayed >= show) {
|
|
1082
|
-
trObj.style.display = 'none';
|
|
1083
|
-
showLaterArray.push(trObj);
|
|
1084
|
-
}
|
|
1085
|
-
} else {
|
|
1086
|
-
// ToDo: show all the data sources of this statement
|
|
1087
|
-
UI.log.info('there are duplicates here: %s', plist[j + l - 1]);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
// @@a quick fix on the messing problem.
|
|
1091
|
-
if (show === predDups) {
|
|
1092
|
-
predicateTD.setAttribute('rowspan', displayed + 1);
|
|
1093
|
-
}
|
|
1094
|
-
} // end of if (predDups!==1)
|
|
1095
|
-
|
|
1096
|
-
if (show < predDups) {
|
|
1097
|
-
// Add the x more <TR> here
|
|
1098
|
-
var moreTR = dom.createElement('tr');
|
|
1099
|
-
var moreTD = moreTR.appendChild(dom.createElement('td'));
|
|
1100
|
-
moreTD.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
|
|
1101
|
-
moreTD.setAttribute('notSelectable', 'false');
|
|
1102
|
-
if (predDups > n) {
|
|
1103
|
-
// what is this for??
|
|
1104
|
-
var small = dom.createElement('a');
|
|
1105
|
-
moreTD.appendChild(small);
|
|
1106
|
-
var predToggle = function (f) {
|
|
1107
|
-
return f(predicateTD, k, dups, n);
|
|
1108
|
-
}(function (predicateTD, k, dups, n) {
|
|
1109
|
-
return function (display) {
|
|
1110
|
-
small.innerHTML = '';
|
|
1111
|
-
if (display === 'none') {
|
|
1112
|
-
small.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-more-trans.png', 'more', 'See all', dom));
|
|
1113
|
-
small.appendChild(dom.createTextNode(predDups - n + ' more...'));
|
|
1114
|
-
predicateTD.setAttribute('rowspan', n + 1);
|
|
1115
|
-
} else {
|
|
1116
|
-
small.appendChild(UI.utils.AJARImage(UI.icons.originalIconBase + 'tbl-shrink.png', '(less)', undefined, dom));
|
|
1117
|
-
predicateTD.setAttribute('rowspan', predDups + 1);
|
|
1118
|
-
}
|
|
1119
|
-
for (var i = 0; i < showLaterArray.length; i++) {
|
|
1120
|
-
var _trObj = showLaterArray[i];
|
|
1121
|
-
_trObj.style.display = display;
|
|
1122
|
-
}
|
|
1123
|
-
};
|
|
1124
|
-
}); // ???
|
|
1125
|
-
var current = 'none';
|
|
1126
|
-
var toggleObj = function toggleObj(event) {
|
|
1127
|
-
predToggle(current);
|
|
1128
|
-
current = current === 'none' ? '' : 'none';
|
|
1129
|
-
if (event) event.stopPropagation();
|
|
1130
|
-
return false; // what is this for?
|
|
1131
|
-
};
|
|
1132
|
-
toggleObj();
|
|
1133
|
-
small.addEventListener('click', toggleObj, false);
|
|
1134
|
-
} // if(predDups>n)
|
|
1135
|
-
parent.appendChild(moreTR);
|
|
1136
|
-
} // if
|
|
1137
|
-
}; // tr.showNobj
|
|
1138
|
-
|
|
1139
|
-
tr.showAllobj = function () {
|
|
1140
|
-
tr.showNobj(k - dups);
|
|
1141
|
-
};
|
|
1142
|
-
tr.showNobj(10);
|
|
1143
|
-
j += k - 1; // extra push
|
|
1144
|
-
},
|
|
1145
|
-
_ret;
|
|
1146
|
-
for (j = 0; j < max; j++) {
|
|
1147
|
-
_ret = _loop();
|
|
1148
|
-
if (_ret === 0) continue;
|
|
1149
|
-
}
|
|
1150
|
-
} // appendPropertyTRs
|
|
1151
|
-
|
|
1152
|
-
this.appendPropertyTRs = appendPropertyTRs;
|
|
1153
|
-
|
|
1154
|
-
/* termWidget
|
|
1155
|
-
**
|
|
1156
|
-
*/
|
|
1157
|
-
var termWidget = {}; // @@@@@@ global
|
|
1158
|
-
global.termWidget = termWidget;
|
|
1159
|
-
termWidget.construct = function (dom) {
|
|
1160
|
-
dom = dom || document;
|
|
1161
|
-
var td = dom.createElement('TD');
|
|
1162
|
-
td.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
|
|
1163
|
-
td.setAttribute('class', 'iconTD');
|
|
1164
|
-
td.setAttribute('notSelectable', 'true');
|
|
1165
|
-
td.style.width = '0px';
|
|
1166
|
-
return td;
|
|
1167
|
-
};
|
|
1168
|
-
termWidget.addIcon = function (td, icon, listener) {
|
|
1169
|
-
var iconTD = td.childNodes[1];
|
|
1170
|
-
if (!iconTD) return;
|
|
1171
|
-
var width = iconTD.style.width;
|
|
1172
|
-
var img = UI.utils.AJARImage(icon.src, icon.alt, icon.tooltip, dom);
|
|
1173
|
-
width = parseInt(width);
|
|
1174
|
-
width = width + icon.width;
|
|
1175
|
-
iconTD.style.width = width + 'px';
|
|
1176
|
-
iconTD.appendChild(img);
|
|
1177
|
-
if (listener) {
|
|
1178
|
-
img.addEventListener('click', listener);
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
termWidget.removeIcon = function (td, icon) {
|
|
1182
|
-
var iconTD = td.childNodes[1];
|
|
1183
|
-
var baseURI;
|
|
1184
|
-
if (!iconTD) return;
|
|
1185
|
-
var width = iconTD.style.width;
|
|
1186
|
-
width = parseInt(width);
|
|
1187
|
-
width = width - icon.width;
|
|
1188
|
-
iconTD.style.width = width + 'px';
|
|
1189
|
-
for (var x = 0; x < iconTD.childNodes.length; x++) {
|
|
1190
|
-
var elt = iconTD.childNodes[x];
|
|
1191
|
-
var eltSrc = elt.src;
|
|
1192
|
-
|
|
1193
|
-
// ignore first '?' and everything after it //Kenny doesn't know what this is for
|
|
1194
|
-
try {
|
|
1195
|
-
baseURI = dom.location.href.split('?')[0];
|
|
1196
|
-
} catch (e) {
|
|
1197
|
-
console.log(e);
|
|
1198
|
-
baseURI = '';
|
|
1199
|
-
}
|
|
1200
|
-
var relativeIconSrc = UI.rdf.uri.join(icon.src, baseURI);
|
|
1201
|
-
if (eltSrc === relativeIconSrc) {
|
|
1202
|
-
iconTD.removeChild(elt);
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
};
|
|
1206
|
-
termWidget.replaceIcon = function (td, oldIcon, newIcon, listener) {
|
|
1207
|
-
termWidget.removeIcon(td, oldIcon);
|
|
1208
|
-
termWidget.addIcon(td, newIcon, listener);
|
|
1209
|
-
};
|
|
1210
|
-
|
|
1211
|
-
// / /////////////////////////////////////////////////// VALUE BROWSER VIEW
|
|
1212
|
-
|
|
1213
|
-
// / /////////////////////////////////////////////////////// TABLE VIEW
|
|
1214
|
-
|
|
1215
|
-
// Summarize a thing as a table cell
|
|
1216
|
-
|
|
1217
|
-
/**********************
|
|
1218
|
-
query global vars
|
|
1219
|
-
***********************/
|
|
1220
|
-
|
|
1221
|
-
// const doesn't work in Opera
|
|
1222
|
-
// const BLANK_QUERY = { pat: kb.formula(), vars: [], orderBy: [] };
|
|
1223
|
-
// @ pat: the query pattern in an RDFIndexedFormula. Statements are in pat.statements
|
|
1224
|
-
// @ vars: the free variables in the query
|
|
1225
|
-
// @ orderBy: the variables to order the table
|
|
1226
|
-
|
|
1227
|
-
function QueryObj() {
|
|
1228
|
-
this.pat = kb.formula();
|
|
1229
|
-
this.vars = [];
|
|
1230
|
-
// this.orderBy = []
|
|
1231
|
-
}
|
|
1232
|
-
var queries = [];
|
|
1233
|
-
queries[0] = new QueryObj();
|
|
1234
|
-
/*
|
|
1235
|
-
function querySave () {
|
|
1236
|
-
queries.push(queries[0])
|
|
1237
|
-
var choices = dom.getElementById('queryChoices')
|
|
1238
|
-
var next = dom.createElement('option')
|
|
1239
|
-
var box = dom.createElement('input')
|
|
1240
|
-
var index = queries.length - 1
|
|
1241
|
-
box.setAttribute('type', 'checkBox')
|
|
1242
|
-
box.setAttribute('value', index)
|
|
1243
|
-
choices.appendChild(box)
|
|
1244
|
-
choices.appendChild(dom.createTextNode('Saved query #' + index))
|
|
1245
|
-
choices.appendChild(dom.createElement('br'))
|
|
1246
|
-
next.setAttribute('value', index)
|
|
1247
|
-
next.appendChild(dom.createTextNode('Saved query #' + index))
|
|
1248
|
-
dom.getElementById('queryJump').appendChild(next)
|
|
1249
|
-
}
|
|
1250
|
-
*/
|
|
1251
|
-
/*
|
|
1252
|
-
function resetQuery () {
|
|
1253
|
-
function resetOutliner (pat) {
|
|
1254
|
-
var n = pat.statements.length
|
|
1255
|
-
var pattern, tr
|
|
1256
|
-
for (let i = 0; i < n; i++) {
|
|
1257
|
-
pattern = pat.statements[i]
|
|
1258
|
-
tr = pattern.tr
|
|
1259
|
-
// UI.log.debug('tr: ' + tr.AJAR_statement);
|
|
1260
|
-
if (typeof tr !== 'undefined') {
|
|
1261
|
-
delete tr.AJAR_pattern
|
|
1262
|
-
delete tr.AJAR_variable
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
for (let x in pat.optional) { resetOutliner(pat.optional[x]) }
|
|
1266
|
-
}
|
|
1267
|
-
resetOutliner(myQuery.pat)
|
|
1268
|
-
UI.utils.clearVariableNames()
|
|
1269
|
-
queries[0] = myQuery = new QueryObj()
|
|
1270
|
-
}
|
|
1271
|
-
*/
|
|
1272
|
-
function addButtonCallbacks(target, fireOn) {
|
|
1273
|
-
UI.log.debug('Button callbacks for ' + fireOn + ' added');
|
|
1274
|
-
var makeIconCallback = function makeIconCallback(icon) {
|
|
1275
|
-
return function IconCallback(req) {
|
|
1276
|
-
if (req.indexOf('#') >= 0) {
|
|
1277
|
-
console.log('@@ makeIconCallback: Not expecting # in URI whose state changed: ' + req);
|
|
1278
|
-
// alert('Should have no hash in '+req)
|
|
1279
|
-
}
|
|
1280
|
-
if (!target) {
|
|
1281
|
-
return false;
|
|
1282
|
-
}
|
|
1283
|
-
if (!outline.ancestor(target, 'DIV')) return false;
|
|
1284
|
-
// if (term.termType != 'symbol') { return true } // should always ve
|
|
1285
|
-
if (req === fireOn) {
|
|
1286
|
-
target.src = icon;
|
|
1287
|
-
target.title = _outlineIcons.outlineIcons.tooltips[icon];
|
|
1288
|
-
}
|
|
1289
|
-
return true;
|
|
1290
|
-
};
|
|
1291
|
-
};
|
|
1292
|
-
sf.addCallback('request', makeIconCallback(_outlineIcons.outlineIcons.src.icon_requested));
|
|
1293
|
-
sf.addCallback('done', makeIconCallback(_outlineIcons.outlineIcons.src.icon_fetched));
|
|
1294
|
-
sf.addCallback('fail', makeIconCallback(_outlineIcons.outlineIcons.src.icon_failed));
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
// Selection support
|
|
1298
|
-
|
|
1299
|
-
function selected(node) {
|
|
1300
|
-
var a = node.getAttribute('class');
|
|
1301
|
-
if (a && a.indexOf('selected') >= 0) return true;
|
|
1302
|
-
return false;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
// These woulkd be simpler using closer variables below
|
|
1306
|
-
function optOnIconMouseDownListener(e) {
|
|
1307
|
-
// outlineIcons.src.icon_opton needed?
|
|
1308
|
-
var target = thisOutline.targetOf(e);
|
|
1309
|
-
var p = target.parentNode;
|
|
1310
|
-
termWidget.replaceIcon(p.parentNode, _outlineIcons.outlineIcons.termWidgets.optOn, _outlineIcons.outlineIcons.termWidgets.optOff, optOffIconMouseDownListener);
|
|
1311
|
-
p.parentNode.parentNode.removeAttribute('optional');
|
|
1312
|
-
}
|
|
1313
|
-
function optOffIconMouseDownListener(e) {
|
|
1314
|
-
// outlineIcons.src.icon_optoff needed?
|
|
1315
|
-
var target = thisOutline.targetOf(e);
|
|
1316
|
-
var p = target.parentNode;
|
|
1317
|
-
termWidget.replaceIcon(p.parentNode, _outlineIcons.outlineIcons.termWidgets.optOff, _outlineIcons.outlineIcons.termWidgets.optOn, optOnIconMouseDownListener);
|
|
1318
|
-
p.parentNode.parentNode.setAttribute('optional', 'true');
|
|
1319
|
-
}
|
|
1320
|
-
function setSelectedParent(node, inc) {
|
|
1321
|
-
var onIcon = _outlineIcons.outlineIcons.termWidgets.optOn;
|
|
1322
|
-
var offIcon = _outlineIcons.outlineIcons.termWidgets.optOff;
|
|
1323
|
-
for (var n = node; n.parentNode; n = n.parentNode) {
|
|
1324
|
-
while (true) {
|
|
1325
|
-
if (n.getAttribute('predTR')) {
|
|
1326
|
-
var num = n.getAttribute('parentOfSelected');
|
|
1327
|
-
if (!num) num = 0;else num = parseInt(num);
|
|
1328
|
-
if (num === 0 && inc > 0) {
|
|
1329
|
-
termWidget.addIcon(n.childNodes[0], n.getAttribute('optional') ? onIcon : offIcon, n.getAttribute('optional') ? optOnIconMouseDownListener : optOffIconMouseDownListener);
|
|
1330
|
-
}
|
|
1331
|
-
num = num + inc;
|
|
1332
|
-
n.setAttribute('parentOfSelected', num);
|
|
1333
|
-
if (num === 0) {
|
|
1334
|
-
n.removeAttribute('parentOfSelected');
|
|
1335
|
-
termWidget.removeIcon(n.childNodes[0], n.getAttribute('optional') ? onIcon : offIcon);
|
|
1336
|
-
}
|
|
1337
|
-
break;
|
|
1338
|
-
} else if (n.previousSibling && n.previousSibling.nodeName === 'TR') {
|
|
1339
|
-
n = n.previousSibling;
|
|
1340
|
-
} else break;
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
this.statusBarClick = function (event) {
|
|
1345
|
-
var target = UI.utils.getTarget(event);
|
|
1346
|
-
if (target.label) {
|
|
1347
|
-
window.content.location = target.label;
|
|
1348
|
-
// The following alternative does not work in the extension.
|
|
1349
|
-
// var s = store.sym(target.label);
|
|
1350
|
-
// outline.GotoSubject(s, true);
|
|
1351
|
-
}
|
|
1352
|
-
};
|
|
1353
|
-
this.showURI = function showURI(about) {
|
|
1354
|
-
if (about && dom.getElementById('UserURI')) {
|
|
1355
|
-
dom.getElementById('UserURI').value = about.termType === 'NamedNode' ? about.uri : ''; // blank if no URI
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
this.showSource = function showSource() {
|
|
1359
|
-
if (typeof sourceWidget === 'undefined') return;
|
|
1360
|
-
// deselect all before going on, this is necessary because you would switch tab,
|
|
1361
|
-
// close tab or so on...
|
|
1362
|
-
for (var uri in sourceWidget.sources) {
|
|
1363
|
-
sourceWidget.sources[uri].setAttribute('class', '');
|
|
1364
|
-
} // .class doesn't work. Be careful!
|
|
1365
|
-
for (var i = 0; i < selection.length; i++) {
|
|
1366
|
-
if (!selection[i].parentNode) {
|
|
1367
|
-
console.log('showSource: EH? no parentNode? ' + selection[i] + '\n');
|
|
1368
|
-
continue;
|
|
1369
|
-
}
|
|
1370
|
-
var st = selection[i].parentNode.AJAR_statement;
|
|
1371
|
-
if (!st) continue; // for root TD
|
|
1372
|
-
var source = st.why;
|
|
1373
|
-
if (source && source.uri) {
|
|
1374
|
-
sourceWidget.highlight(source, true);
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
};
|
|
1378
|
-
this.getSelection = function getSelection() {
|
|
1379
|
-
return selection;
|
|
1380
|
-
};
|
|
1381
|
-
function setSelected(node, newValue) {
|
|
1382
|
-
// UI.log.info('selection has ' +selection.map(function(item){return item.textContent;}).join(', '));
|
|
1383
|
-
// UI.log.debug('@outline setSelected, intended to '+(newValue?'select ':'deselect ')+node+node.textContent);
|
|
1384
|
-
// if (newValue === selected(node)) return; //we might not need this anymore...
|
|
1385
|
-
if (node.nodeName !== 'TD') {
|
|
1386
|
-
UI.log.debug('down' + node.nodeName);
|
|
1387
|
-
throw new Error('Expected TD in setSelected: ' + node.nodeName + ' : ' + node.textContent);
|
|
1388
|
-
}
|
|
1389
|
-
UI.log.debug('pass');
|
|
1390
|
-
var cla = node.getAttribute('class');
|
|
1391
|
-
if (!cla) cla = '';
|
|
1392
|
-
if (newValue) {
|
|
1393
|
-
cla += ' selected';
|
|
1394
|
-
if (cla.indexOf('pred') >= 0 || cla.indexOf('obj') >= 0) {
|
|
1395
|
-
setSelectedParent(node, 1);
|
|
1396
|
-
}
|
|
1397
|
-
selection.push(node);
|
|
1398
|
-
// UI.log.info('Selecting '+node.textContent)
|
|
1399
|
-
|
|
1400
|
-
var about = UI.utils.getTerm(node); // show uri for a newly selectedTd
|
|
1401
|
-
thisOutline.showURI(about);
|
|
1402
|
-
var st = node.AJAR_statement; // show blue cross when the why of that triple is editable
|
|
1403
|
-
if (typeof st === 'undefined' && node.parentNode) st = node.parentNode.AJAR_statement;
|
|
1404
|
-
// if (typeof st === 'undefined') return; // @@ Kludge? Click in the middle of nowhere
|
|
1405
|
-
if (st) {
|
|
1406
|
-
// don't do these for headers or base nodes
|
|
1407
|
-
var source = st.why;
|
|
1408
|
-
// var target = st.why
|
|
1409
|
-
var editable = _solidLogic.store.updater.editable(source.uri, kb);
|
|
1410
|
-
if (!editable) {
|
|
1411
|
-
// let target = node.parentNode.AJAR_inverse ? st.object : st.subject
|
|
1412
|
-
} // left hand side
|
|
1413
|
-
// think about this later. Because we update to the why for now.
|
|
1414
|
-
// alert('Target='+target+', editable='+editable+'\nselected statement:' + st)
|
|
1415
|
-
if (editable && cla.indexOf('pred') >= 0) {
|
|
1416
|
-
termWidget.addIcon(node, _outlineIcons.outlineIcons.termWidgets.addTri);
|
|
1417
|
-
} // Add blue plus
|
|
1418
|
-
}
|
|
1419
|
-
} else {
|
|
1420
|
-
UI.log.debug('cla=$' + cla + '$');
|
|
1421
|
-
if (cla === 'selected') cla = ''; // for header <TD>
|
|
1422
|
-
cla = cla.replace(' selected', '');
|
|
1423
|
-
if (cla.indexOf('pred') >= 0 || cla.indexOf('obj') >= 0) {
|
|
1424
|
-
setSelectedParent(node, -1);
|
|
1425
|
-
}
|
|
1426
|
-
if (cla.indexOf('pred') >= 0) {
|
|
1427
|
-
termWidget.removeIcon(node, _outlineIcons.outlineIcons.termWidgets.addTri);
|
|
1428
|
-
}
|
|
1429
|
-
selection = selection.filter(function (x) {
|
|
1430
|
-
return x === node;
|
|
1431
|
-
});
|
|
1432
|
-
UI.log.info('Deselecting ' + node.textContent);
|
|
1433
|
-
}
|
|
1434
|
-
if (typeof sourceWidget !== 'undefined') thisOutline.showSource(); // Update the data sources display
|
|
1435
|
-
// UI.log.info('selection becomes [' +selection.map(function(item){return item.textContent;}).join(', ')+']');
|
|
1436
|
-
// UI.log.info('Setting className ' + cla);
|
|
1437
|
-
node.setAttribute('class', cla);
|
|
1438
|
-
}
|
|
1439
|
-
function deselectAll() {
|
|
1440
|
-
var n = selection.length;
|
|
1441
|
-
for (var i = n - 1; i >= 0; i--) setSelected(selection[i], false);
|
|
1442
|
-
selection = [];
|
|
1443
|
-
}
|
|
1444
|
-
|
|
1445
|
-
/** Get the target of an event **/
|
|
1446
|
-
this.targetOf = function (e) {
|
|
1447
|
-
var target;
|
|
1448
|
-
if (!e) e = window.event;
|
|
1449
|
-
if (e.target) {
|
|
1450
|
-
target = e.target;
|
|
1451
|
-
} else if (e.srcElement) {
|
|
1452
|
-
target = e.srcElement;
|
|
1453
|
-
} else {
|
|
1454
|
-
UI.log.error("can't get target for event " + e);
|
|
1455
|
-
return false;
|
|
1456
|
-
} // fail
|
|
1457
|
-
if (target.nodeType === 3) {
|
|
1458
|
-
// defeat Safari bug [sic]
|
|
1459
|
-
target = target.parentNode;
|
|
1460
|
-
}
|
|
1461
|
-
return target;
|
|
1462
|
-
}; // targetOf
|
|
1463
|
-
|
|
1464
|
-
this.walk = function walk(directionCode, inputTd) {
|
|
1465
|
-
var selectedTd = inputTd || selection[0];
|
|
1466
|
-
var newSelTd;
|
|
1467
|
-
switch (directionCode) {
|
|
1468
|
-
case 'down':
|
|
1469
|
-
try {
|
|
1470
|
-
newSelTd = selectedTd.parentNode.nextSibling.lastChild;
|
|
1471
|
-
} catch (e) {
|
|
1472
|
-
this.walk('up');
|
|
1473
|
-
return;
|
|
1474
|
-
} // end
|
|
1475
|
-
deselectAll();
|
|
1476
|
-
setSelected(newSelTd, true);
|
|
1477
|
-
break;
|
|
1478
|
-
case 'up':
|
|
1479
|
-
try {
|
|
1480
|
-
newSelTd = selectedTd.parentNode.previousSibling.lastChild;
|
|
1481
|
-
} catch (e) {
|
|
1482
|
-
return;
|
|
1483
|
-
} // top
|
|
1484
|
-
deselectAll();
|
|
1485
|
-
setSelected(newSelTd, true);
|
|
1486
|
-
break;
|
|
1487
|
-
case 'right':
|
|
1488
|
-
deselectAll();
|
|
1489
|
-
if (selectedTd.nextSibling || selectedTd.lastChild.tagName === 'strong') {
|
|
1490
|
-
setSelected(selectedTd.nextSibling, true);
|
|
1491
|
-
} else {
|
|
1492
|
-
var newSelected = dom.evaluate('table/div/tr/td[2]', selectedTd, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
|
|
1493
|
-
setSelected(newSelected, true);
|
|
1494
|
-
}
|
|
1495
|
-
break;
|
|
1496
|
-
case 'left':
|
|
1497
|
-
deselectAll();
|
|
1498
|
-
if (selectedTd.previousSibling && selectedTd.previousSibling.className === 'undetermined') {
|
|
1499
|
-
setSelected(selectedTd.previousSibling, true);
|
|
1500
|
-
return true; // do not shrink signal
|
|
1501
|
-
} else {
|
|
1502
|
-
setSelected(UI.utils.ancestor(selectedTd.parentNode, 'TD'), true);
|
|
1503
|
-
} // supplied by thieOutline.focusTd
|
|
1504
|
-
break;
|
|
1505
|
-
case 'moveTo':
|
|
1506
|
-
// UI.log.info(selection[0].textContent+'->'+inputTd.textContent);
|
|
1507
|
-
deselectAll();
|
|
1508
|
-
setSelected(inputTd, true);
|
|
1509
|
-
break;
|
|
1510
|
-
}
|
|
1511
|
-
if (directionCode === 'down' || directionCode === 'up') {
|
|
1512
|
-
if (!newSelTd.tabulatorSelect) this.walk(directionCode);
|
|
1513
|
-
}
|
|
1514
|
-
// return newSelTd;
|
|
1515
|
-
};
|
|
1516
|
-
|
|
1517
|
-
// Keyboard Input: we can consider this as...
|
|
1518
|
-
// 1. a fast way to modify data - enter will go to next predicate
|
|
1519
|
-
// 2. an alternative way to input - enter at the end of a predicate will create a new statement
|
|
1520
|
-
this.OutlinerKeypressPanel = function OutlinerKeypressPanel(e) {
|
|
1521
|
-
UI.log.info('Key ' + e.keyCode + ' pressed');
|
|
1522
|
-
function showURI(about) {
|
|
1523
|
-
if (about && dom.getElementById('UserURI')) {
|
|
1524
|
-
dom.getElementById('UserURI').value = about.termType === 'NamedNode' ? about.uri : ''; // blank if no URI
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
function setSelectedAfterward(_uri) {
|
|
1528
|
-
if (arguments[3]) return true;
|
|
1529
|
-
walk('right', selectedTd);
|
|
1530
|
-
showURI(UI.utils.getAbout(kb, selection[0]));
|
|
1531
|
-
return true;
|
|
1532
|
-
}
|
|
1533
|
-
var target, editable;
|
|
1534
|
-
if (UI.utils.getTarget(e).tagName === 'TEXTAREA') return;
|
|
1535
|
-
if (UI.utils.getTarget(e).id === 'UserURI') return;
|
|
1536
|
-
if (selection.length > 1) return;
|
|
1537
|
-
if (selection.length === 0) {
|
|
1538
|
-
if (e.keyCode === 13 || e.keyCode === 38 || e.keyCode === 40 || e.keyCode === 37 || e.keyCode === 39) {
|
|
1539
|
-
this.walk('right', thisOutline.focusTd);
|
|
1540
|
-
showURI(UI.utils.getAbout(kb, selection[0]));
|
|
1541
|
-
}
|
|
1542
|
-
return;
|
|
1543
|
-
}
|
|
1544
|
-
var selectedTd = selection[0];
|
|
1545
|
-
// if not done, Have to deal with redraw...
|
|
1546
|
-
sf.removeCallback('done', 'setSelectedAfterward');
|
|
1547
|
-
sf.removeCallback('fail', 'setSelectedAfterward');
|
|
1548
|
-
switch (e.keyCode) {
|
|
1549
|
-
case 13:
|
|
1550
|
-
// enter
|
|
1551
|
-
if (UI.utils.getTarget(e).tagName === 'HTML') {
|
|
1552
|
-
// I don't know why 'HTML'
|
|
1553
|
-
var object = UI.utils.getAbout(kb, selectedTd);
|
|
1554
|
-
target = selectedTd.parentNode.AJAR_statement.why;
|
|
1555
|
-
editable = _solidLogic.store.updater.editable(target.uri, kb);
|
|
1556
|
-
if (object) {
|
|
1557
|
-
// <Feature about='enterToExpand'>
|
|
1558
|
-
outline.GotoSubject(object, true);
|
|
1559
|
-
/* //deal with this later
|
|
1560
|
-
deselectAll();
|
|
1561
|
-
var newTr=dom.getElementById('outline').lastChild;
|
|
1562
|
-
setSelected(newTr.firstChild.firstChild.childNodes[1].lastChild,true);
|
|
1563
|
-
function setSelectedAfterward(uri){
|
|
1564
|
-
deselectAll();
|
|
1565
|
-
setSelected(newTr.firstChild.firstChild.childNodes[1].lastChild,true);
|
|
1566
|
-
showURI(getAbout(kb,selection[0]));
|
|
1567
|
-
return true;
|
|
1568
|
-
}
|
|
1569
|
-
sf.insertCallback('done',setSelectedAfterward);
|
|
1570
|
-
sf.insertCallback('fail',setSelectedAfterward);
|
|
1571
|
-
*/
|
|
1572
|
-
// </Feature>
|
|
1573
|
-
} else if (editable) {
|
|
1574
|
-
// this is a text node and editable
|
|
1575
|
-
thisOutline.UserInput.Enter(selectedTd);
|
|
1576
|
-
}
|
|
1577
|
-
} else {
|
|
1578
|
-
// var newSelTd=thisOutline.UserInput.lastModified.parentNode.parentNode.nextSibling.lastChild;
|
|
1579
|
-
this.UserInput.Keypress(e);
|
|
1580
|
-
this.walk('down'); // bug with input at the end
|
|
1581
|
-
// dom.getElementById('docHTML').focus(); //have to set this or focus blurs
|
|
1582
|
-
e.stopPropagation();
|
|
1583
|
-
}
|
|
1584
|
-
return;
|
|
1585
|
-
case 38:
|
|
1586
|
-
// up
|
|
1587
|
-
// thisOutline.UserInput.clearInputAndSave();
|
|
1588
|
-
// ^^^ does not work because up and down not captured...
|
|
1589
|
-
this.walk('up');
|
|
1590
|
-
e.stopPropagation();
|
|
1591
|
-
e.preventDefault();
|
|
1592
|
-
break;
|
|
1593
|
-
case 40:
|
|
1594
|
-
// down
|
|
1595
|
-
// thisOutline.UserInput.clearInputAndSave();
|
|
1596
|
-
this.walk('down');
|
|
1597
|
-
e.stopPropagation();
|
|
1598
|
-
e.preventDefault();
|
|
1599
|
-
} // switch
|
|
1600
|
-
|
|
1601
|
-
if (UI.utils.getTarget(e).tagName === 'INPUT') return;
|
|
1602
|
-
var walk;
|
|
1603
|
-
switch (e.keyCode) {
|
|
1604
|
-
case 46: // delete
|
|
1605
|
-
case 8:
|
|
1606
|
-
// backspace
|
|
1607
|
-
target = selectedTd.parentNode.AJAR_statement.why;
|
|
1608
|
-
editable = _solidLogic.store.updater.editable(target.uri, kb);
|
|
1609
|
-
if (editable) {
|
|
1610
|
-
e.preventDefault(); // prevent from going back
|
|
1611
|
-
this.UserInput.Delete(selectedTd);
|
|
1612
|
-
}
|
|
1613
|
-
break;
|
|
1614
|
-
case 37:
|
|
1615
|
-
{
|
|
1616
|
-
// left
|
|
1617
|
-
if (this.walk('left')) return;
|
|
1618
|
-
var titleTd = UI.utils.ancestor(selectedTd.parentNode, 'TD');
|
|
1619
|
-
outlineCollapse(selectedTd, UI.utils.getAbout(kb, titleTd));
|
|
1620
|
-
break;
|
|
1621
|
-
}
|
|
1622
|
-
case 39:
|
|
1623
|
-
// right
|
|
1624
|
-
// @@ TODO: Write away the need for exception on next line
|
|
1625
|
-
|
|
1626
|
-
var obj = UI.utils.getAbout(kb, selectedTd);
|
|
1627
|
-
if (obj) {
|
|
1628
|
-
walk = this.walk;
|
|
1629
|
-
if (selectedTd.nextSibling) {
|
|
1630
|
-
// when selectedTd is a predicate
|
|
1631
|
-
this.walk('right');
|
|
1632
|
-
return;
|
|
1633
|
-
}
|
|
1634
|
-
if (selectedTd.firstChild.tagName !== 'TABLE') {
|
|
1635
|
-
// not expanded
|
|
1636
|
-
sf.addCallback('done', setSelectedAfterward);
|
|
1637
|
-
sf.addCallback('fail', setSelectedAfterward);
|
|
1638
|
-
outlineExpand(selectedTd, obj, {
|
|
1639
|
-
pane: paneRegistry.byName('defaultPane')
|
|
1640
|
-
});
|
|
1641
|
-
}
|
|
1642
|
-
setSelectedAfterward();
|
|
1643
|
-
}
|
|
1644
|
-
break;
|
|
1645
|
-
case 38: // up
|
|
1646
|
-
case 40:
|
|
1647
|
-
// down
|
|
1648
|
-
break;
|
|
1649
|
-
default:
|
|
1650
|
-
switch (e.charCode) {
|
|
1651
|
-
case 99:
|
|
1652
|
-
// c for Copy
|
|
1653
|
-
if (e.ctrlKey) {
|
|
1654
|
-
thisOutline.UserInput.copyToClipboard(thisOutline.clipboardAddress, selectedTd);
|
|
1655
|
-
break;
|
|
1656
|
-
}
|
|
1657
|
-
break;
|
|
1658
|
-
case 118: // v
|
|
1659
|
-
case 112:
|
|
1660
|
-
// p for Paste
|
|
1661
|
-
if (e.ctrlKey) {
|
|
1662
|
-
thisOutline.UserInput.pasteFromClipboard(thisOutline.clipboardAddress, selectedTd);
|
|
1663
|
-
// dom.getElementById('docHTML').focus(); //have to set this or focus blurs
|
|
1664
|
-
// window.focus();
|
|
1665
|
-
// e.stopPropagation();
|
|
1666
|
-
break;
|
|
1667
|
-
}
|
|
1668
|
-
break;
|
|
1669
|
-
default:
|
|
1670
|
-
if (UI.utils.getTarget(e).tagName === 'HTML') {
|
|
1671
|
-
/*
|
|
1672
|
-
//<Feature about='typeOnSelectedToInput'>
|
|
1673
|
-
thisOutline.UserInput.Click(e,selectedTd);
|
|
1674
|
-
thisOutline.UserInput.lastModified.value=String.fromCharCode(e.charCode);
|
|
1675
|
-
if (selectedTd.className==='undetermined selected') thisOutline.UserInput.AutoComplete(e.charCode)
|
|
1676
|
-
//</Feature>
|
|
1677
|
-
*/
|
|
1678
|
-
// Events are not reliable...
|
|
1679
|
-
// var e2=document.createEvent('KeyboardEvent');
|
|
1680
|
-
// e2.initKeyEvent('keypress',true,true,null,false,false,false,false,e.keyCode,0);
|
|
1681
|
-
// UserInput.lastModified.dispatchEvent(e2);
|
|
1682
|
-
}
|
|
1683
|
-
}
|
|
1684
|
-
} // end of switch
|
|
1685
|
-
|
|
1686
|
-
showURI(UI.utils.getAbout(kb, selection[0]));
|
|
1687
|
-
// alert(window);alert(doc);
|
|
1688
|
-
/*
|
|
1689
|
-
var wm = Components.classes['@mozilla.org/appshell/window-mediator;1']
|
|
1690
|
-
.getService(Components.interfaces.nsIWindowMediator);
|
|
1691
|
-
var gBrowser = wm.getMostRecentWindow('navigator:browser') */
|
|
1692
|
-
// gBrowser.addTab('http://www.w3.org/');
|
|
1693
|
-
// alert(gBrowser.addTab);alert(gBrowser.scroll);alert(gBrowser.scrollBy)
|
|
1694
|
-
// gBrowser.scrollBy(0,100);
|
|
1695
|
-
|
|
1696
|
-
// var thisHtml=selection[0].owner
|
|
1697
|
-
if (selection[0]) {
|
|
1698
|
-
var PosY = UI.utils.findPos(selection[0])[1];
|
|
1699
|
-
if (PosY + selection[0].clientHeight > window.scrollY + window.innerHeight) {
|
|
1700
|
-
UI.utils.getEyeFocus(selection[0], true, true, window);
|
|
1701
|
-
}
|
|
1702
|
-
if (PosY < window.scrollY + 54) {
|
|
1703
|
-
UI.utils.getEyeFocus(selection[0], true, undefined, window);
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
};
|
|
1707
|
-
this.OutlinerMouseclickPanel = function (e) {
|
|
1708
|
-
switch (thisOutline.UserInput._tabulatorMode) {
|
|
1709
|
-
case 0:
|
|
1710
|
-
TabulatorMousedown(e);
|
|
1711
|
-
break;
|
|
1712
|
-
case 1:
|
|
1713
|
-
thisOutline.UserInput.Click(e);
|
|
1714
|
-
break;
|
|
1715
|
-
default:
|
|
1716
|
-
}
|
|
1717
|
-
};
|
|
1718
|
-
|
|
1719
|
-
/** things to do onmousedown in outline view **/
|
|
1720
|
-
/*
|
|
1721
|
-
** To Do: This big event handler needs to be replaced by lots
|
|
1722
|
-
** of little ones individually connected to each icon. This horrible
|
|
1723
|
-
** switch below isn't modular. (Sorry!) - Tim
|
|
1724
|
-
*/
|
|
1725
|
-
// expand
|
|
1726
|
-
// collapse
|
|
1727
|
-
// refocus
|
|
1728
|
-
// select
|
|
1729
|
-
// visit/open a page
|
|
1730
|
-
|
|
1731
|
-
function expandMouseDownListener(e) {
|
|
1732
|
-
// For icon (UI.icons.originalIconBase + 'tbl-expand-trans.png')
|
|
1733
|
-
var target = thisOutline.targetOf(e);
|
|
1734
|
-
var p = target.parentNode;
|
|
1735
|
-
var subject = UI.utils.getAbout(kb, target);
|
|
1736
|
-
var pane = e.altKey ? paneRegistry.byName('internal') : undefined; // set later: was panes.defaultPane
|
|
1737
|
-
|
|
1738
|
-
if (e.shiftKey) {
|
|
1739
|
-
// Shift forces a refocus - bring this to the top
|
|
1740
|
-
outlineRefocus(p, subject, pane);
|
|
1741
|
-
} else {
|
|
1742
|
-
if (e.altKey) {
|
|
1743
|
-
// To investigate screw ups, dont wait show internals
|
|
1744
|
-
outlineExpand(p, subject, {
|
|
1745
|
-
pane: paneRegistry.byName('internal'),
|
|
1746
|
-
immediate: true
|
|
1747
|
-
});
|
|
1748
|
-
} else {
|
|
1749
|
-
outlineExpand(p, subject);
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1753
|
-
function collapseMouseDownListener(e) {
|
|
1754
|
-
// for icon UI.icons.originalIconBase + 'tbl-collapse.png'
|
|
1755
|
-
var target = thisOutline.targetOf(e);
|
|
1756
|
-
var subject = UI.utils.getAbout(kb, target);
|
|
1757
|
-
var pane = e.altKey ? paneRegistry.byName('internal') : undefined;
|
|
1758
|
-
var p = target.parentNode.parentNode;
|
|
1759
|
-
outlineCollapse(p, subject, pane);
|
|
1760
|
-
}
|
|
1761
|
-
function failedIconMouseDownListener(e) {
|
|
1762
|
-
// outlineIcons.src.icon_failed
|
|
1763
|
-
var target = thisOutline.targetOf(e);
|
|
1764
|
-
var uri = target.getAttribute('uri'); // Put on access buttons
|
|
1765
|
-
if (e.altKey) {
|
|
1766
|
-
sf.fetch(UI.rdf.uri.docpart(uri), {
|
|
1767
|
-
force: true
|
|
1768
|
-
}); // Add 'force' bit?
|
|
1769
|
-
} else {
|
|
1770
|
-
sf.refresh(kb.sym(UI.rdf.uri.docpart(uri))); // just one
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
function fetchedIconMouseDownListener(e) {
|
|
1774
|
-
// outlineIcons.src.icon_fetched
|
|
1775
|
-
var target = thisOutline.targetOf(e);
|
|
1776
|
-
var uri = target.getAttribute('uri'); // Put on access buttons
|
|
1777
|
-
if (e.altKey) {
|
|
1778
|
-
sf.fetch(UI.rdf.uri.docpart(uri), {
|
|
1779
|
-
force: true
|
|
1780
|
-
});
|
|
1781
|
-
} else {
|
|
1782
|
-
sf.refresh(kb.sym(UI.rdf.uri.docpart(uri))); // just one
|
|
1783
|
-
}
|
|
1784
|
-
}
|
|
1785
|
-
function unrequestedIconMouseDownListener(e) {
|
|
1786
|
-
var target = thisOutline.targetOf(e);
|
|
1787
|
-
var uri = target.getAttribute('uri'); // Put on access buttons
|
|
1788
|
-
sf.fetch(UI.rdf.uri.docpart(uri));
|
|
1789
|
-
}
|
|
1790
|
-
function removeNodeIconMouseDownListener(e) {
|
|
1791
|
-
// icon_remove_node
|
|
1792
|
-
var target = thisOutline.targetOf(e);
|
|
1793
|
-
var node = target.node;
|
|
1794
|
-
if (node.childNodes.length > 1) node = target.parentNode; // parallel outline view @@ Hack
|
|
1795
|
-
removeAndRefresh(node); // @@ update icons for pane?
|
|
1796
|
-
}
|
|
1797
|
-
function selectableTDClickListener(e) {
|
|
1798
|
-
// Is we are in editing mode already
|
|
1799
|
-
if (thisOutline.UserInput._tabulatorMode) {
|
|
1800
|
-
return thisOutline.UserInput.Click(e);
|
|
1801
|
-
}
|
|
1802
|
-
var target = thisOutline.targetOf(e);
|
|
1803
|
-
// Originally this was set on the whole tree and could happen anywhere
|
|
1804
|
-
// var p = target.parentNode
|
|
1805
|
-
var node;
|
|
1806
|
-
for (node = UI.utils.ancestor(target, 'TD'); node && !(node.getAttribute('notSelectable') === 'false');
|
|
1807
|
-
// Default now is not selectable
|
|
1808
|
-
node = UI.utils.ancestor(node.parentNode, 'TD')) {
|
|
1809
|
-
// ...
|
|
1810
|
-
}
|
|
1811
|
-
if (!node) return;
|
|
1812
|
-
|
|
1813
|
-
// var node = target;
|
|
1814
|
-
|
|
1815
|
-
var sel = selected(node);
|
|
1816
|
-
// var cla = node.getAttribute('class')
|
|
1817
|
-
UI.log.debug('Was node selected before: ' + sel);
|
|
1818
|
-
if (e.altKey) {
|
|
1819
|
-
setSelected(node, !selected(node));
|
|
1820
|
-
} else if (e.shiftKey) {
|
|
1821
|
-
setSelected(node, true);
|
|
1822
|
-
} else {
|
|
1823
|
-
// setSelected(node, !selected(node))
|
|
1824
|
-
deselectAll();
|
|
1825
|
-
thisOutline.UserInput.clearInputAndSave(e);
|
|
1826
|
-
setSelected(node, true);
|
|
1827
|
-
if (e.detail === 2) {
|
|
1828
|
-
// double click -> quit TabulatorMousedown()
|
|
1829
|
-
e.stopPropagation();
|
|
1830
|
-
return;
|
|
1831
|
-
}
|
|
1832
|
-
// if the node is already selected and the corresponding statement is editable,
|
|
1833
|
-
// go to UserInput
|
|
1834
|
-
var st;
|
|
1835
|
-
if (node.parentNode) st = node.parentNode.AJAR_statement;
|
|
1836
|
-
if (!st) return; // For example in the title TD of an expanded pane
|
|
1837
|
-
var _target = st.why;
|
|
1838
|
-
var editable = _solidLogic.store.updater.editable(_target.uri, kb);
|
|
1839
|
-
if (sel && editable) thisOutline.UserInput.Click(e, selection[0]); // was next 2 lines
|
|
1840
|
-
// var text='TabulatorMouseDown@Outline()';
|
|
1841
|
-
// HCIoptions['able to edit in Discovery Mode by mouse'].setupHere([sel,e,thisOutline,selection[0]],text);
|
|
1842
|
-
}
|
|
1843
|
-
UI.log.debug('Was node selected after: ' + selected(node) + ', count=' + selection.length);
|
|
1844
|
-
// var tr = node.parentNode
|
|
1845
|
-
/*
|
|
1846
|
-
if (tr.AJAR_statement) {
|
|
1847
|
-
// var why = tr.AJAR_statement.why
|
|
1848
|
-
// UI.log.info('Information from '+why);
|
|
1849
|
-
}
|
|
1850
|
-
*/
|
|
1851
|
-
e.stopPropagation();
|
|
1852
|
-
// this is important or conflict between deselect and user input happens
|
|
1853
|
-
}
|
|
1854
|
-
function TabulatorMousedown(e) {
|
|
1855
|
-
UI.log.info('@TabulatorMousedown, dom.location is now ' + dom.location);
|
|
1856
|
-
var target = thisOutline.targetOf(e);
|
|
1857
|
-
if (!target) return;
|
|
1858
|
-
var tname = target.tagName;
|
|
1859
|
-
// UI.log.debug('TabulatorMousedown: ' + tname + ' shift='+e.shiftKey+' alt='+e.altKey+' ctrl='+e.ctrlKey);
|
|
1860
|
-
// var p = target.parentNode
|
|
1861
|
-
// var about = UI.utils.getAbout(kb, target)
|
|
1862
|
-
// var source = null
|
|
1863
|
-
if (tname === 'INPUT' || tname === 'TEXTAREA') {
|
|
1864
|
-
return;
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
// not input then clear
|
|
1868
|
-
thisOutline.UserInput.clearMenu();
|
|
1869
|
-
|
|
1870
|
-
// ToDo:remove this and recover X
|
|
1871
|
-
if (thisOutline.UserInput.lastModified && thisOutline.UserInput.lastModified.parentNode.nextSibling) {
|
|
1872
|
-
thisOutline.UserInput.backOut();
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
// if (typeof rav=='undefined') //uncomment this for javascript2rdf
|
|
1876
|
-
// have to put this here or this conflicts with deselectAll()
|
|
1877
|
-
|
|
1878
|
-
if (!target.src || target.src.slice(target.src.indexOf('/icons/') + 1) !== _outlineIcons.outlineIcons.src.icon_show_choices && target.src.slice(target.src.indexOf('/icons/') + 1) !== _outlineIcons.outlineIcons.src.icon_add_triple) {
|
|
1879
|
-
thisOutline.UserInput.clearInputAndSave(e);
|
|
1880
|
-
}
|
|
1881
|
-
if (!target.src || target.src.slice(target.src.indexOf('/icons/') + 1) !== _outlineIcons.outlineIcons.src.icon_show_choices) {
|
|
1882
|
-
thisOutline.UserInput.clearMenu();
|
|
1883
|
-
}
|
|
1884
|
-
if (e) e.stopPropagation();
|
|
1885
|
-
} // function TabulatorMousedown
|
|
1886
|
-
|
|
1887
|
-
function setUrlBarAndTitle(subject) {
|
|
1888
|
-
dom.title = UI.utils.label(subject);
|
|
1889
|
-
if (dom.location.href.startsWith(subject.site().uri)) {
|
|
1890
|
-
// dom.location = subject.uri // No causes reload
|
|
1891
|
-
}
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
/** Expand an outline view
|
|
1895
|
-
* @param p {Element} - container
|
|
1896
|
-
*/
|
|
1897
|
-
function outlineExpand(p, subject1, options) {
|
|
1898
|
-
options = options || {};
|
|
1899
|
-
var pane = options.pane;
|
|
1900
|
-
var already = !!options.already;
|
|
1901
|
-
var immediate = options.immediate;
|
|
1902
|
-
UI.log.info('@outlineExpand, dom is now ' + dom.location);
|
|
1903
|
-
// remove callback to prevent unexpected repaint
|
|
1904
|
-
sf.removeCallback('done', 'expand');
|
|
1905
|
-
sf.removeCallback('fail', 'expand');
|
|
1906
|
-
var subject = kb.canon(subject1);
|
|
1907
|
-
// var requTerm = subject.uri ? kb.sym(UI.rdf.uri.docpart(subject.uri)) : subject
|
|
1908
|
-
|
|
1909
|
-
function render() {
|
|
1910
|
-
subject = kb.canon(subject);
|
|
1911
|
-
if (!p || !p.parentNode || !p.parentNode.parentNode) return false;
|
|
1912
|
-
var newTable;
|
|
1913
|
-
UI.log.info('@@ REPAINTING ');
|
|
1914
|
-
if (!already) {
|
|
1915
|
-
// first expand
|
|
1916
|
-
newTable = propertyTable(subject, undefined, pane, options);
|
|
1917
|
-
} else {
|
|
1918
|
-
UI.log.info(' ... p is ' + p);
|
|
1919
|
-
for (newTable = p.firstChild; newTable.nextSibling; newTable = newTable.nextSibling) {
|
|
1920
|
-
UI.log.info(' ... checking node ' + newTable);
|
|
1921
|
-
if (newTable.nodeName === 'table') break;
|
|
1922
|
-
}
|
|
1923
|
-
newTable = propertyTable(subject, newTable, pane, options);
|
|
1924
|
-
}
|
|
1925
|
-
already = true;
|
|
1926
|
-
if (UI.utils.ancestor(p, 'TABLE') && UI.utils.ancestor(p, 'TABLE').style.backgroundColor === 'white') {
|
|
1927
|
-
newTable.style.backgroundColor = '#eee';
|
|
1928
|
-
} else {
|
|
1929
|
-
newTable.style.backgroundColor = 'white';
|
|
1930
|
-
}
|
|
1931
|
-
UI.utils.emptyNode(p).appendChild(newTable);
|
|
1932
|
-
thisOutline.focusTd = p; // I don't know why I couldn't use 'this'...because not defined in callbacks
|
|
1933
|
-
UI.log.debug('expand: Node for ' + subject + ' expanded');
|
|
1934
|
-
// fetch seeAlso when render()
|
|
1935
|
-
// var seeAlsoStats = sf.store.statementsMatching(subject, UI.ns.rdfs('seeAlso'))
|
|
1936
|
-
// seeAlsoStats.map(function (x) {sf.lookUpThing(x.object, subject,false);})
|
|
1937
|
-
var seeAlsoWhat = kb.each(subject, UI.ns.rdfs('seeAlso'));
|
|
1938
|
-
for (var i = 0; i < seeAlsoWhat.length; i++) {
|
|
1939
|
-
if (i === 25) {
|
|
1940
|
-
UI.log.warn('expand: Warning: many (' + seeAlsoWhat.length + ') seeAlso links for ' + subject);
|
|
1941
|
-
// break; Not sure what limits the AJAX system has here
|
|
1942
|
-
}
|
|
1943
|
-
sf.lookUpThing(seeAlsoWhat[i], subject);
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
function expand(uri) {
|
|
1947
|
-
if (arguments[3]) return true; // already fetched indicator
|
|
1948
|
-
var cursubj = kb.canon(subject); // canonical identifier may have changed
|
|
1949
|
-
UI.log.info('@@ expand: relevant subject=' + cursubj + ', uri=' + uri + ', already=' + already);
|
|
1950
|
-
// var term = kb.sym(uri)
|
|
1951
|
-
var docTerm = kb.sym(UI.rdf.uri.docpart(uri));
|
|
1952
|
-
if (uri.indexOf('#') >= 0) {
|
|
1953
|
-
throw new Error('Internal error: hash in ' + uri);
|
|
1954
|
-
}
|
|
1955
|
-
var relevant = function relevant() {
|
|
1956
|
-
// Is the loading of this URI relevam to the display of subject?
|
|
1957
|
-
if (!cursubj.uri) return true; // bnode should expand()
|
|
1958
|
-
var as = kb.uris(cursubj);
|
|
1959
|
-
if (!as) return false;
|
|
1960
|
-
for (var i = 0; i < as.length; i++) {
|
|
1961
|
-
// canon'l uri or any alias
|
|
1962
|
-
for (var rd = UI.rdf.uri.docpart(as[i]); rd; rd = kb.HTTPRedirects[rd]) {
|
|
1963
|
-
if (uri === rd) return true;
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
if (kb.anyStatementMatching(cursubj, undefined, undefined, docTerm)) {
|
|
1967
|
-
return true;
|
|
1968
|
-
} // Kenny: inverse?
|
|
1969
|
-
return false;
|
|
1970
|
-
};
|
|
1971
|
-
if (relevant()) {
|
|
1972
|
-
UI.log.success('@@ expand OK: relevant subject=' + cursubj + ', uri=' + uri + ', source=' + already);
|
|
1973
|
-
render();
|
|
1974
|
-
return false; // @@@@@@@@@@@ Will this allow just the first
|
|
1975
|
-
}
|
|
1976
|
-
return true;
|
|
1977
|
-
}
|
|
1978
|
-
// Body of outlineExpand
|
|
1979
|
-
|
|
1980
|
-
if (options.solo) {
|
|
1981
|
-
setUrlBarAndTitle(subject);
|
|
1982
|
-
}
|
|
1983
|
-
UI.log.debug('outlineExpand: dereferencing ' + subject);
|
|
1984
|
-
var status = dom.createElement('span');
|
|
1985
|
-
p.appendChild(status);
|
|
1986
|
-
sf.addCallback('done', expand); // @@@@@@@ This can really mess up existing work
|
|
1987
|
-
sf.addCallback('fail', expand); // Need to do if there s one a gentle resync of page with store
|
|
1988
|
-
|
|
1989
|
-
var returnConditions = []; // this is quite a general way to do cut and paste programming
|
|
1990
|
-
// I might make a class for this
|
|
1991
|
-
if (subject.uri && subject.uri.split(':')[0] === 'rdf') {
|
|
1992
|
-
// what is this? -tim
|
|
1993
|
-
render();
|
|
1994
|
-
return;
|
|
1995
|
-
}
|
|
1996
|
-
for (var i = 0; i < returnConditions.length; i++) {
|
|
1997
|
-
var returnCode = void 0;
|
|
1998
|
-
if (returnCode === returnConditions[i](subject)) {
|
|
1999
|
-
render();
|
|
2000
|
-
UI.log.debug('outline 1815');
|
|
2001
|
-
if (returnCode[1]) outlineElement.removeChild(outlineElement.lastChild);
|
|
2002
|
-
return;
|
|
2003
|
-
}
|
|
2004
|
-
}
|
|
2005
|
-
if (subject.uri && !immediate && !UI.widgets.isAudio(subject) && !UI.widgets.isVideo(subject)) {
|
|
2006
|
-
// Wait till at least the main URI is loaded before expanding:
|
|
2007
|
-
sf.nowOrWhenFetched(subject.doc(), undefined, function (ok, body) {
|
|
2008
|
-
if (ok) {
|
|
2009
|
-
sf.lookUpThing(subject);
|
|
2010
|
-
render(); // inital open, or else full if re-open
|
|
2011
|
-
if (options.solo) {
|
|
2012
|
-
// Update window title with new information
|
|
2013
|
-
// dom.title = UI.utils.label(subject)
|
|
2014
|
-
setUrlBarAndTitle(subject);
|
|
2015
|
-
}
|
|
2016
|
-
} else {
|
|
2017
|
-
var message = dom.createElement('pre');
|
|
2018
|
-
message.textContent = body;
|
|
2019
|
-
message.setAttribute('style', 'background-color: #fee;');
|
|
2020
|
-
message.textContent = 'Outline.expand: Unable to fetch ' + subject.doc() + ': ' + body;
|
|
2021
|
-
p.appendChild(message);
|
|
2022
|
-
}
|
|
2023
|
-
});
|
|
2024
|
-
} else {
|
|
2025
|
-
render();
|
|
2026
|
-
}
|
|
2027
|
-
} // outlineExpand
|
|
2028
|
-
|
|
2029
|
-
function outlineCollapse(p, subject) {
|
|
2030
|
-
var row = UI.utils.ancestor(p, 'TR');
|
|
2031
|
-
row = UI.utils.ancestor(row.parentNode, 'TR'); // two levels up
|
|
2032
|
-
var statement;
|
|
2033
|
-
if (row) statement = row.AJAR_statement;
|
|
2034
|
-
var level; // find level (the enclosing TD)
|
|
2035
|
-
for (level = p.parentNode; level.tagName !== 'TD'; level = level.parentNode) {
|
|
2036
|
-
if (typeof level === 'undefined') {
|
|
2037
|
-
alert('Not enclosed in TD!');
|
|
2038
|
-
return;
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
UI.log.debug('Collapsing subject ' + subject);
|
|
2042
|
-
var myview;
|
|
2043
|
-
if (statement) {
|
|
2044
|
-
UI.log.debug('looking up pred ' + statement.predicate.uri + 'in defaults');
|
|
2045
|
-
myview = views.defaults[statement.predicate.uri];
|
|
2046
|
-
}
|
|
2047
|
-
UI.log.debug('view= ' + myview);
|
|
2048
|
-
var deleteNode;
|
|
2049
|
-
if (level.parentNode.parentNode.id === 'outline') {
|
|
2050
|
-
deleteNode = level.parentNode;
|
|
2051
|
-
}
|
|
2052
|
-
thisOutline.replaceTD(thisOutline.outlineObjectTD(subject, myview, deleteNode, statement), level);
|
|
2053
|
-
} // outlineCollapse
|
|
2054
|
-
|
|
2055
|
-
this.replaceTD = function replaceTD(newTd, replacedTd) {
|
|
2056
|
-
var reselect;
|
|
2057
|
-
if (selected(replacedTd)) reselect = true;
|
|
2058
|
-
|
|
2059
|
-
// deselects everything being collapsed. This goes backwards because
|
|
2060
|
-
// deselecting an element decreases selection.length
|
|
2061
|
-
for (var x = selection.length - 1; x > -1; x--) {
|
|
2062
|
-
for (var elt = selection[x]; elt.parentNode; elt = elt.parentNode) {
|
|
2063
|
-
if (elt === replacedTd) {
|
|
2064
|
-
setSelected(selection[x], false);
|
|
2065
|
-
}
|
|
2066
|
-
}
|
|
2067
|
-
}
|
|
2068
|
-
replacedTd.parentNode.replaceChild(newTd, replacedTd);
|
|
2069
|
-
if (reselect) setSelected(newTd, true);
|
|
2070
|
-
};
|
|
2071
|
-
function outlineRefocus(p, subject) {
|
|
2072
|
-
// Shift-expand or shift-collapse: Maximize
|
|
2073
|
-
var outer = null;
|
|
2074
|
-
for (var level = p.parentNode; level; level = level.parentNode) {
|
|
2075
|
-
UI.log.debug('level ' + level.tagName);
|
|
2076
|
-
if (level.tagName === 'TD') outer = level;
|
|
2077
|
-
} // find outermost td
|
|
2078
|
-
UI.utils.emptyNode(outer).appendChild(propertyTable(subject));
|
|
2079
|
-
setUrlBarAndTitle(subject);
|
|
2080
|
-
// dom.title = UI.utils.label(subject)
|
|
2081
|
-
outer.setAttribute('about', subject.toNT());
|
|
2082
|
-
} // outlineRefocus
|
|
2083
|
-
|
|
2084
|
-
outline.outlineRefocus = outlineRefocus;
|
|
2085
|
-
|
|
2086
|
-
// Inversion is turning the outline view inside-out
|
|
2087
|
-
// It may be called eversion
|
|
2088
|
-
/*
|
|
2089
|
-
function outlineInversion (p, subject) { // re-root at subject
|
|
2090
|
-
function move_root (rootTR, childTR) { // swap root with child
|
|
2091
|
-
// @@
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
*/
|
|
2095
|
-
this.GotoFormURI_enterKey = function (e) {
|
|
2096
|
-
if (e.keyCode === 13) outline.GotoFormURI(e);
|
|
2097
|
-
};
|
|
2098
|
-
this.GotoFormURI = function (_e) {
|
|
2099
|
-
GotoURI(dom.getElementById('UserURI').value);
|
|
2100
|
-
};
|
|
2101
|
-
function GotoURI(uri) {
|
|
2102
|
-
var subject = kb.sym(uri);
|
|
2103
|
-
this.GotoSubject(subject, true);
|
|
2104
|
-
}
|
|
2105
|
-
this.GotoURIinit = function (uri) {
|
|
2106
|
-
var subject = kb.sym(uri);
|
|
2107
|
-
this.GotoSubject(subject);
|
|
2108
|
-
};
|
|
2109
|
-
|
|
2110
|
-
/** Display the subject in an outline view
|
|
2111
|
-
@param subject -- RDF term for teh thing to be presented
|
|
2112
|
-
@param expand -- flag -- open the subject rather than keep folded closed
|
|
2113
|
-
@param pane -- optional -- pane to be used for expanded display
|
|
2114
|
-
@param solo -- optional -- the window will be cleared out and only the subject displayed
|
|
2115
|
-
@param referer -- optional -- where did we hear about this from anyway?
|
|
2116
|
-
@param table -- option -- a table element in which to put the outline.
|
|
2117
|
-
*/
|
|
2118
|
-
this.GotoSubject = function (subject, expand, pane, solo, referrer, table) {
|
|
2119
|
-
table = table || dom.getElementById('outline'); // if does not exist just add one? nowhere to out it
|
|
2120
|
-
if (solo) {
|
|
2121
|
-
UI.utils.emptyNode(table);
|
|
2122
|
-
table.style.width = '100%';
|
|
2123
|
-
}
|
|
2124
|
-
function GotoSubjectDefault() {
|
|
2125
|
-
var tr = dom.createElement('TR');
|
|
2126
|
-
tr.style.verticalAlign = 'top';
|
|
2127
|
-
table.appendChild(tr);
|
|
2128
|
-
var td = thisOutline.outlineObjectTD(subject, undefined, tr);
|
|
2129
|
-
tr.appendChild(td);
|
|
2130
|
-
return td;
|
|
2131
|
-
}
|
|
2132
|
-
var td = GotoSubjectDefault();
|
|
2133
|
-
if (solo) setUrlBarAndTitle(subject); // dom.title = UI.utils.label(subject) // 'Tabulator: '+ No need to advertize
|
|
2134
|
-
|
|
2135
|
-
if (expand) {
|
|
2136
|
-
outlineExpand(td, subject, {
|
|
2137
|
-
pane: pane,
|
|
2138
|
-
solo: solo
|
|
2139
|
-
});
|
|
2140
|
-
var tr = td.parentNode;
|
|
2141
|
-
UI.utils.getEyeFocus(tr, false, undefined, window); // instantly: false
|
|
2142
|
-
}
|
|
2143
|
-
if (solo && dom && dom.defaultView && dom.defaultView.history &&
|
|
2144
|
-
// Don't add the new location to the history if we arrived here through a direct link
|
|
2145
|
-
// (i.e. when static/databrowser.html in node-solid-server called this method):
|
|
2146
|
-
document.location.href !== subject.uri) {
|
|
2147
|
-
var stateObj = pane ? {
|
|
2148
|
-
paneName: pane.name
|
|
2149
|
-
} : {};
|
|
2150
|
-
try {
|
|
2151
|
-
// can fail if different origin
|
|
2152
|
-
dom.defaultView.history.pushState(stateObj, subject.uri, subject.uri);
|
|
2153
|
-
} catch (e) {
|
|
2154
|
-
console.log(e);
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
return subject;
|
|
2158
|
-
};
|
|
2159
|
-
|
|
2160
|
-
// / /////////////////////////////////////////////////////
|
|
2161
|
-
//
|
|
2162
|
-
//
|
|
2163
|
-
// VIEWS
|
|
2164
|
-
//
|
|
2165
|
-
//
|
|
2166
|
-
// / /////////////////////////////////////////////////////
|
|
2167
|
-
|
|
2168
|
-
var ns = UI.ns;
|
|
2169
|
-
var views = (0, _propertyViews.propertyViews)(dom);
|
|
2170
|
-
|
|
2171
|
-
// var thisOutline = this dup
|
|
2172
|
-
/** some builtin simple views **/
|
|
2173
|
-
|
|
2174
|
-
function viewAsBoringDefault(obj) {
|
|
2175
|
-
// UI.log.debug('entered viewAsBoringDefault...');
|
|
2176
|
-
var rep; // representation in html
|
|
2177
|
-
|
|
2178
|
-
if (obj.termType === 'Literal') {
|
|
2179
|
-
var styles = {
|
|
2180
|
-
integer: 'text-align: right;',
|
|
2181
|
-
decimal: "text-align: '.';",
|
|
2182
|
-
"double": "text-align: '.';"
|
|
2183
|
-
};
|
|
2184
|
-
rep = dom.createElement('span');
|
|
2185
|
-
rep.textContent = obj.value;
|
|
2186
|
-
// Newlines have effect and overlong lines wrapped automatically
|
|
2187
|
-
var style = '';
|
|
2188
|
-
if (obj.datatype && obj.datatype.uri) {
|
|
2189
|
-
var xsd = UI.ns.xsd('').uri;
|
|
2190
|
-
if (obj.datatype.uri.slice(0, xsd.length) === xsd) {
|
|
2191
|
-
style = styles[obj.datatype.uri.slice(xsd.length)];
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
rep.setAttribute('style', style || 'white-space: pre-wrap;');
|
|
2195
|
-
} else if (obj.termType === 'NamedNode' || obj.termType === 'BlankNode') {
|
|
2196
|
-
rep = dom.createElement('span');
|
|
2197
|
-
rep.setAttribute('about', obj.toNT());
|
|
2198
|
-
thisOutline.appendAccessIcons(kb, rep, obj);
|
|
2199
|
-
if (obj.termType === 'NamedNode') {
|
|
2200
|
-
if (obj.uri.slice(0, 4) === 'tel:') {
|
|
2201
|
-
var num = obj.uri.slice(4);
|
|
2202
|
-
var anchor = dom.createElement('a');
|
|
2203
|
-
rep.appendChild(dom.createTextNode(num));
|
|
2204
|
-
anchor.setAttribute('href', obj.uri);
|
|
2205
|
-
anchor.appendChild(UI.utils.AJARImage(_outlineIcons.outlineIcons.src.icon_telephone, 'phone', 'phone ' + num, dom));
|
|
2206
|
-
rep.appendChild(anchor);
|
|
2207
|
-
anchor.firstChild.setAttribute('class', 'phoneIcon');
|
|
2208
|
-
} else {
|
|
2209
|
-
// not tel:
|
|
2210
|
-
rep.appendChild(dom.createTextNode(UI.utils.label(obj)));
|
|
2211
|
-
var _anchor = UI.widgets.linkIcon(dom, obj);
|
|
2212
|
-
rep.appendChild(_anchor);
|
|
2213
|
-
UI.widgets.makeDraggable(rep, obj); // 2017
|
|
2214
|
-
}
|
|
2215
|
-
} else {
|
|
2216
|
-
// bnode
|
|
2217
|
-
rep.appendChild(dom.createTextNode(UI.utils.label(obj)));
|
|
2218
|
-
}
|
|
2219
|
-
} else if (obj.termType === 'Collection') {
|
|
2220
|
-
// obj.elements is an array of the elements in the collection
|
|
2221
|
-
rep = dom.createElement('table');
|
|
2222
|
-
rep.setAttribute('style', 'width: 100%;');
|
|
2223
|
-
rep.setAttribute('about', obj.toNT());
|
|
2224
|
-
/* Not sure which looks best -- with or without. I think without
|
|
2225
|
-
var tr = rep.appendChild(document.createElement('tr'));
|
|
2226
|
-
tr.appendChild(document.createTextNode(
|
|
2227
|
-
obj.elements.length ? '(' + obj.elements.length+')' : '(none)'));
|
|
2228
|
-
*/
|
|
2229
|
-
for (var i = 0; i < obj.elements.length; i++) {
|
|
2230
|
-
var elt = obj.elements[i];
|
|
2231
|
-
var row = rep.appendChild(dom.createElement('tr'));
|
|
2232
|
-
var numcell = row.appendChild(dom.createElement('td'));
|
|
2233
|
-
numcell.setAttribute('style', 'margin: 0.2em; border: none; padding: 0; vertical-align: top;');
|
|
2234
|
-
numcell.setAttribute('notSelectable', 'false');
|
|
2235
|
-
numcell.setAttribute('about', obj.toNT());
|
|
2236
|
-
numcell.innerHTML = i + 1 + ')';
|
|
2237
|
-
row.appendChild(thisOutline.outlineObjectTD(elt));
|
|
2238
|
-
}
|
|
2239
|
-
} else if (obj.termType === 'Graph') {
|
|
2240
|
-
rep = paneRegistry.byName('dataContentPane').statementsAsTables(obj.statements, context);
|
|
2241
|
-
rep.setAttribute('class', 'nestedFormula');
|
|
2242
|
-
} else {
|
|
2243
|
-
UI.log.error('Object ' + obj + ' has unknown term type: ' + obj.termType);
|
|
2244
|
-
rep = dom.createTextNode('[unknownTermType:' + obj.termType + ']');
|
|
2245
|
-
} // boring defaults.
|
|
2246
|
-
UI.log.debug('contents: ' + rep.innerHTML);
|
|
2247
|
-
return rep;
|
|
2248
|
-
} // boring_default
|
|
2249
|
-
|
|
2250
|
-
this.createTabURI = function () {
|
|
2251
|
-
dom.getElementById('UserURI').value = dom.URL + '?uri=' + dom.getElementById('UserURI').value;
|
|
2252
|
-
};
|
|
2253
|
-
|
|
2254
|
-
// a way to expose variables to UserInput without making them propeties/methods
|
|
2255
|
-
this.UserInput.setSelected = setSelected;
|
|
2256
|
-
this.UserInput.deselectAll = deselectAll;
|
|
2257
|
-
this.UserInput.views = views;
|
|
2258
|
-
this.outlineExpand = outlineExpand;
|
|
2259
|
-
|
|
2260
|
-
// this.panes = panes; // Allow external panes to register
|
|
2261
|
-
|
|
2262
|
-
return this;
|
|
2263
|
-
} // END OF OUTLINE
|
|
2264
|
-
//# sourceMappingURL=manager.js.map
|