diff options
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r-- | src/client/documents/Documents.ts | 137 |
1 files changed, 65 insertions, 72 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index cf397e85a..ddb6f65b6 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -246,8 +246,8 @@ export class DocumentOptions { _nativeWidth?: NUMt = new NumInfo('native width of document contents (e.g., the pixel width of an image)', false); _nativeHeight?: NUMt = new NumInfo('native height of document contents (e.g., the pixel height of an image)', false); - 'acl-Guest'?: STRt = new StrInfo("permissions granted to users logged in as 'guest' (either view, or private)"); // public permissions - '_acl-Guest'?: string; // public permissions + acl_Guest?: STRt = new StrInfo("permissions granted to users logged in as 'guest' (either view, or private)"); // public permissions + _acl_Guest?: string; // public permissions type?: DTYPEt = new DTypeInfo('type of document', true); type_collection?: COLLt = new CTypeInfo('how collection is rendered'); // sub type of a collection _type_collection?: COLLt = new CTypeInfo('how collection is rendered'); // sub type of a collection @@ -535,6 +535,7 @@ export namespace Docs { { layout: { view: FormattedTextBox, dataField: 'text' }, options: { + acl: '', _height: 35, _xMargin: 10, _yMargin: 10, @@ -550,21 +551,21 @@ export namespace Docs { DocumentType.SEARCH, { layout: { view: SearchBox, dataField: defaultDataKey }, - options: { _width: 400 }, + options: { acl: '', _width: 400 }, }, ], [ DocumentType.IMG, { layout: { view: ImageBox, dataField: defaultDataKey }, - options: { freeform: '', systemIcon: 'BsFileEarmarkImageFill' }, + options: { acl: '', freeform: '', systemIcon: 'BsFileEarmarkImageFill' }, }, ], [ DocumentType.WEB, { layout: { view: WebBox, dataField: defaultDataKey }, - options: { _height: 300, _layout_fitWidth: true, layout_nativeDimEditable: true, layout_reflowVertical: true, waitForDoubleClickToClick: 'always', systemIcon: 'BsGlobe' }, + options: { acl: '', _height: 300, _layout_fitWidth: true, layout_nativeDimEditable: true, layout_reflowVertical: true, waitForDoubleClickToClick: 'always', systemIcon: 'BsGlobe' }, }, ], [ @@ -572,6 +573,7 @@ export namespace Docs { { layout: { view: CollectionView, dataField: defaultDataKey }, options: { + acl: '', _layout_fitWidth: true, freeform: '', _freeform_panX: 0, @@ -588,42 +590,42 @@ export namespace Docs { DocumentType.KVP, { layout: { view: KeyValueBox, dataField: defaultDataKey }, - options: { _layout_fitWidth: true, _height: 150 }, + options: { acl: '', _layout_fitWidth: true, _height: 150 }, }, ], [ DocumentType.VID, { layout: { view: VideoBox, dataField: defaultDataKey }, - options: { _layout_currentTimecode: 0, systemIcon: 'BsFileEarmarkPlayFill' }, + options: { acl: '', _layout_currentTimecode: 0, systemIcon: 'BsFileEarmarkPlayFill' }, }, ], [ DocumentType.AUDIO, { layout: { view: AudioBox, dataField: defaultDataKey }, - options: { _height: 100, layout_fitWidth: true, layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true, systemIcon: 'BsFillVolumeUpFill' }, + options: { acl: '', _height: 100, layout_fitWidth: true, layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true, systemIcon: 'BsFillVolumeUpFill' }, }, ], [ DocumentType.REC, { layout: { view: VideoBox, dataField: defaultDataKey }, - options: { _height: 100, backgroundColor: 'pink', systemIcon: 'BsFillMicFill' }, + options: { acl: '', _height: 100, backgroundColor: 'pink', systemIcon: 'BsFillMicFill' }, }, ], [ DocumentType.PDF, { layout: { view: PDFBox, dataField: defaultDataKey }, - options: { _layout_curPage: 1, _layout_fitWidth: true, layout_nativeDimEditable: true, layout_reflowVertical: true, systemIcon: 'BsFileEarmarkPdfFill' }, + options: { acl: '', _layout_curPage: 1, _layout_fitWidth: true, layout_nativeDimEditable: true, layout_reflowVertical: true, systemIcon: 'BsFileEarmarkPdfFill' }, }, ], [ DocumentType.MAP, { layout: { view: MapBox, dataField: defaultDataKey }, - options: { map: '', _height: 600, _width: 800, layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true, systemIcon: 'BsFillPinMapFill' }, + options: { acl: '', map: '', _height: 600, _width: 800, layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true, systemIcon: 'BsFillPinMapFill' }, }, ], [ @@ -631,6 +633,7 @@ export namespace Docs { { layout: { view: LinkBox, dataField: 'link' }, options: { + acl: '', childDontRegisterViews: true, layout_hideLinkAnchors: true, _height: 1, @@ -647,88 +650,77 @@ export namespace Docs { { data: new List<Doc>(), layout: { view: EmptyBox, dataField: defaultDataKey }, - options: { title: 'Global Script Database' }, + options: { acl: '', title: 'Global Script Database' }, }, ], [ DocumentType.SCRIPTING, { layout: { view: ScriptingBox, dataField: defaultDataKey }, - options: { systemIcon: 'BsFileEarmarkCodeFill' }, + options: { acl: '', systemIcon: 'BsFileEarmarkCodeFill' }, }, ], [ DocumentType.LABEL, { layout: { view: LabelBox, dataField: 'title' }, - options: { _singleLine: true, layout_nativeDimEditable: true, layout_reflowHorizontal: true, layout_reflowVertical: true }, + options: { acl: '', _singleLine: true, layout_nativeDimEditable: true, layout_reflowHorizontal: true, layout_reflowVertical: true }, }, ], [ DocumentType.EQUATION, { layout: { view: EquationBox, dataField: 'text' }, - options: { - fontSize: '14px', - layout_reflowHorizontal: true, - layout_reflowVertical: true, - layout_nativeDimEditable: true, - layout_hideDecorationTitle: true, - systemIcon: 'BsCalculatorFill', - }, // systemIcon: 'BsSuperscript' + BsSubscript + options: { acl: '', fontSize: '14px', layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true, layout_hideDecorationTitle: true, systemIcon: 'BsCalculatorFill' }, // systemIcon: 'BsSuperscript' + BsSubscript }, ], [ DocumentType.FUNCPLOT, { layout: { view: FunctionPlotBox, dataField: defaultDataKey }, - options: { - layout_reflowHorizontal: true, - layout_reflowVertical: true, - layout_nativeDimEditable: true, - }, + options: { acl: '', layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true }, }, ], [ DocumentType.BUTTON, { layout: { view: LabelBox, dataField: 'title' }, - options: { layout_nativeDimEditable: true, layout_reflowHorizontal: true, layout_reflowVertical: true }, + options: { acl: '', layout_nativeDimEditable: true, layout_reflowHorizontal: true, layout_reflowVertical: true }, }, ], [ DocumentType.PRES, { layout: { view: PresBox, dataField: defaultDataKey }, - options: { defaultDoubleClick: 'ignore', hideClickBehaviors: true, layout_hideLinkAnchors: true }, + options: { acl: '', defaultDoubleClick: 'ignore', hideClickBehaviors: true, layout_hideLinkAnchors: true }, }, ], [ DocumentType.FONTICON, { layout: { view: FontIconBox, dataField: 'icon' }, - options: { defaultDoubleClick: 'ignore', waitForDoubleClickToClick: 'never', layout_hideContextMenu: true, layout_hideLinkButton: true, _width: 40, _height: 40 }, + options: { acl: '', defaultDoubleClick: 'ignore', waitForDoubleClickToClick: 'never', layout_hideContextMenu: true, layout_hideLinkButton: true, _width: 40, _height: 40 }, }, ], [ DocumentType.WEBCAM, { layout: { view: RecordingBox, dataField: defaultDataKey }, - options: { systemIcon: 'BsFillCameraVideoFill' }, + options: { acl: '', systemIcon: 'BsFillCameraVideoFill' }, }, ], [ DocumentType.PRESELEMENT, { layout: { view: PresElementBox, dataField: defaultDataKey }, - options: { title: 'pres element template', _layout_fitWidth: true, _xMargin: 0, isTemplateDoc: true, isTemplateForField: 'data' }, + options: { acl: '', title: 'pres element template', _layout_fitWidth: true, _xMargin: 0, isTemplateDoc: true, isTemplateForField: 'data' }, }, ], [ DocumentType.CONFIG, { layout: { view: CollectionView, dataField: defaultDataKey }, - options: { config: '', layout_hideLinkButton: true, layout_unrendered: true }, + options: { acl: '', config: '', layout_hideLinkButton: true, layout_unrendered: true }, }, ], [ @@ -737,6 +729,7 @@ export namespace Docs { // NOTE: this is unused!! ink fields are filled in directly within the InkDocument() method layout: { view: InkingStroke, dataField: 'stroke' }, options: { + acl: '', systemIcon: 'BsFillPencilFill', // layout_nativeDimEditable: true, layout_reflowVertical: true, @@ -751,7 +744,7 @@ export namespace Docs { DocumentType.SCREENSHOT, { layout: { view: ScreenshotBox, dataField: defaultDataKey }, - options: { layout_nativeDimEditable: true, systemIcon: 'BsCameraFill' }, + options: { acl: '', layout_nativeDimEditable: true, systemIcon: 'BsCameraFill' }, }, ], [ @@ -759,35 +752,48 @@ export namespace Docs { { data: '', layout: { view: ComparisonBox, dataField: defaultDataKey }, - options: { backgroundColor: 'gray', dropAction: dropActionType.move, waitForDoubleClickToClick: 'always', layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true, systemIcon: 'BsLayoutSplit' }, + options: { + acl: '', + backgroundColor: 'gray', + dropAction: dropActionType.move, + waitForDoubleClickToClick: 'always', + layout_reflowHorizontal: true, + layout_reflowVertical: true, + layout_nativeDimEditable: true, + systemIcon: 'BsLayoutSplit', + }, }, ], [ DocumentType.GROUPDB, { layout: { view: EmptyBox, dataField: defaultDataKey }, - options: { title: 'Global Group Database' }, - }, - ], - [ - DocumentType.GROUP, - { - layout: { view: EmptyBox, dataField: defaultDataKey }, - options: {}, + options: { acl: '', title: 'Global Group Database' }, }, ], [ DocumentType.DATAVIZ, { layout: { view: DataVizBox, dataField: defaultDataKey }, - options: { dataViz_title: '', dataViz_line: '', dataViz_pie: '', dataViz_histogram: '', dataViz: 'table', _layout_fitWidth: true, layout_reflowHorizontal: true, layout_reflowVertical: true, layout_nativeDimEditable: true }, + options: { + acl: '', + dataViz_title: '', + dataViz_line: '', + dataViz_pie: '', + dataViz_histogram: '', + dataViz: 'table', + _layout_fitWidth: true, + layout_reflowHorizontal: true, + layout_reflowVertical: true, + layout_nativeDimEditable: true, + }, }, ], [ DocumentType.LOADING, { layout: { view: LoadingBox, dataField: '' }, - options: { _layout_fitWidth: true, _fitHeight: true, layout_nativeDimEditable: true }, + options: { acl: '', _layout_fitWidth: true, _fitHeight: true, layout_nativeDimEditable: true }, }, ], [ @@ -795,41 +801,28 @@ export namespace Docs { { data: '', layout: { view: PhysicsSimulationBox, dataField: defaultDataKey, _width: 1000, _height: 800 }, - options: { - _height: 100, - mass1: '', - mass2: '', - layout_nativeDimEditable: true, - position: '', - acceleration: '', - pendulum: '', - spring: '', - wedge: '', - simulation: '', - review: '', - systemIcon: 'BsShareFill', - }, + options: { acl: '', _height: 100, mass1: '', mass2: '', layout_nativeDimEditable: true, position: '', acceleration: '', pendulum: '', spring: '', wedge: '', simulation: '', review: '', systemIcon: 'BsShareFill' }, }, ], [ DocumentType.PUSHPIN, { layout: { view: MapPushpinBox, dataField: defaultDataKey }, - options: {}, + options: { acl: '' }, }, ], [ DocumentType.MAPROUTE, { layout: { view: CollectionView, dataField: defaultDataKey }, - options: {}, + options: { acl: '' }, }, ], [ DocumentType.CALENDAR, { layout: { view: CalendarBox, dataField: defaultDataKey }, - options: {}, + options: { acl: '' }, }, ], ]); @@ -926,7 +919,7 @@ export namespace Docs { type, isBaseProto: true, _width: 300, - 'acl-Guest': SharingPermissions.View, + acl_Guest: SharingPermissions.View, ...(template.options || {}), layout: layout.view?.LayoutString(layout.dataField), data: template.data, @@ -971,8 +964,8 @@ export namespace Docs { const viewKeys = ['x', 'y', 'isSystem']; // keys that should be addded to the view document even though they don't begin with an "_" const { omit: dataProps, extract: viewProps } = OmitKeys(options, viewKeys, '^_'); - // dataProps['acl-Override'] = SharingPermissions.Unset; - dataProps['acl-Guest'] = options['acl-Guest'] ?? (Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.View); + // dataProps.acl_Override = SharingPermissions.Unset; + dataProps.acl_Guest = options.acl_Guest ?? (Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.View); dataProps.isSystem = viewProps.isSystem; dataProps.isDataDoc = true; dataProps.author = ClientUtils.CurrentUserEmail(); @@ -996,7 +989,7 @@ export namespace Docs { if (!noView) { const viewFirstProps: { [id: string]: any } = { author: ClientUtils.CurrentUserEmail() }; - viewFirstProps['acl-Guest'] = options['_acl-Guest'] ?? (Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.View); + viewFirstProps.acl_Guest = options._acl_Guest ?? (Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.View); let viewDoc: Doc; // determines whether viewDoc should be created using placeholder Doc or default if (placeholderDoc) { @@ -1004,7 +997,7 @@ export namespace Docs { placeholderDoc._width = options._width !== undefined ? Number(options._width) : undefined; viewDoc = Doc.assign(placeholderDoc, viewFirstProps, true, true); Array.from(Object.keys(placeholderDoc)) - .filter(key => key.startsWith('acl')) + .filter(key => key.startsWith('acl_')) .forEach(key => { dataDoc[key] = viewDoc[key] = placeholderDoc[key]; }); @@ -1157,8 +1150,8 @@ export namespace Docs { I.rotation = 0; I.defaultDoubleClick = 'ignore'; I.author_date = new DateField(); - I['acl-Guest'] = Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.View; - // I['acl-Override'] = SharingPermissions.Unset; + I.acl_Guest = Doc.defaultAclPrivate ? SharingPermissions.None : SharingPermissions.View; + // I.acl_Override = SharingPermissions.Unset; I[Initializing] = false; return ink; @@ -1335,7 +1328,7 @@ export namespace Docs { const doc = DockDocument( configs.map(c => c.doc), JSON.stringify(layoutConfig), - ClientUtils.CurrentUserEmail() === 'guest' ? options : { 'acl-Guest': SharingPermissions.View, ...options }, + ClientUtils.CurrentUserEmail() === 'guest' ? options : { acl_Guest: SharingPermissions.View, ...options }, id ); configs.forEach(c => { @@ -1539,8 +1532,8 @@ export namespace DocUtils { source, target, { - 'acl-Guest': SharingPermissions.Augment, - '_acl-Guest': SharingPermissions.Augment, + acl_Guest: SharingPermissions.Augment, + _acl_Guest: SharingPermissions.Augment, title: ComputedField.MakeFunction('generateLinkTitle(this)') as any, link_anchor_1_useSmallAnchor: source.useSmallAnchor ? true : undefined, link_anchor_2_useSmallAnchor: target.useSmallAnchor ? true : undefined, |