PlotDirector/Docs/Locations/Workspace.md

6.8 KiB

Locations workspace

The main directory uses the existing dbo.Locations identifiers. LocationWorkspaceController reads a flat directory and recorded associations using Dapper and Location_WorkspaceRead. The browser builds hierarchy paths and child indexes without a recursive SQL view or per-location queries. The initial MVC request reads the authorised project only. Associated manuscript prose is never loaded. Existing Details/Edit, archive, scene assignment and relationship forms remain.

The three panels reuse workspace-surface.js (a Locations profile), shared theme tokens, PlotDirectorContextMenus, PlotDirector.toast and ContextWorkspaceNotifications.Invalidate. Browser and installed PWA use the same commands and same-window links. Nothing changes narrative focus or invokes AI/geocoding. Location images are not currently a canonical location attribute; there are no fabricated image placeholders.

Canonical attributes

Existing types: Country, Region, Town, Village, Street, Building, Floor, Room, Outdoor Area, Vehicle Interior, Landmark and Other. Migration 335 adds Planet, District, Natural Feature and City without changing existing IDs or values. Existing aliases, description, Quick Add inclusion, Word Companion exclusion and detection priority are retained. Quick Add and detection exclusion are suitable quick switches; numeric detection priority remains in the full form.

Locations.Classification is optional: NULL (Unclassified), Real, Fictional, Fictionalised. It is independent of type. No existing location is classified automatically. Classification is edited in the workspace and preserved by existing full forms, which do not update this column. LocationItem.Classification and the existing export selector preserve it through project backups; the generic restore contract already accepts the additional column. LocationWorkspaceIcons maps canonical labels onto opt-in shared ribbon icons without changing other consumers.

Mutation and hierarchy safety

Location_WorkspaceAssign validates project role (Owner/Collaborator), active project/location, canonical values, parent membership and optimistic UpdatedDate versions inside a transaction. Only the selected attribute is written. Permanent containment can be arbitrarily nested. The final parent graph is checked on the server, including Undo; cycles and self/descendant moves are rejected. Root is NULL. For ordinary bulk moves, selected descendants whose ancestor is also selected are omitted, retaining complete branches. Undo restores only the roots actually changed. No-op assignments do not update timestamps or audit history. Unavailable ancestors are shown as “Parent unavailable”; original parent IDs are retained, and the Root filter means an actual NULL parent. Recorded unavailable types remain visible in Details rather than being relabelled Unclassified.

Each mutation records the established project audit. Audit result sets are captured internally. The response returns exact post-save versions and changed values. A user-bound, protected receipt expires after ten minutes; Undo compares the current version before applying the original value. A stale receipt cannot overwrite later edits. The browser updates its directory, counts and details without navigating/reloading. Live invalidations refresh other windows; dirty descriptions defer refresh. Explicit Save/Cancel and discard confirmation protect unsaved descriptions.

Location_WorkspaceCreate validates ownership/parent and creates a child transactionally from only a name. Naming matches existing forms (required, 200 characters; repeated names are allowed). Aliases and manuscript text are never rewritten by rename. Traditional creation remains available.

Merge

Workspace merge is explicit, reviewed and has no Undo. The author chooses the survivor and sees both descriptions and type/classification conflicts. Location_WorkspaceMerge validates both record versions and the editing role, then wraps the established Location_Merge transaction. That operation transfers scene/character/asset references, children, aliases, floor plans, import references and non-hierarchical links; direct source/survivor links are archived. The forward-only extension to the established merge also transfers MapFeatures.LocationID and increments affected map revisions without changing any feature ID or geometry. Different descriptions are retained together with a source label. An unclassified survivor inherits source classification; otherwise survivor classification wins. Survivor name, type and parent remain. Source records and original information stay archived. Geographic confirmation evidence stays with its original record and is not inferred for the survivor. The older full merge form remains available and receives the same preservation safeguards. The workspace additionally previews conflicts and rejects records changed since review.

Filters, associations and preferences

Map/floor-plan indicators come from MapFeatures and direct plan/floor/block links. Multiple links are listed individually rather than selecting one implicitly. Map links open the existing selected map; floor-plan links open its existing editor. Location/feature reveal inside those editors is limited to their current route contracts. Scene use counts distinct recorded primary, character current/entry/exit and asset scene assignments; it is not textual name matching. Relationship, explicitly located character and current asset counts come from authoritative records; full evidence remains on Details. Derived filters are read-only. Branch-filter results retain ancestors without modifying permanent expansion state.

pd.locations.workspace.v1.<user>.<project> stores view, sorting, expanded branches, collapsed panels and expanded attribute groups. The shared divider key is independently scoped to the same user/project. Dragging dividers writes local preferences only on completion. Narrow displays stack the panels, without horizontal page overflow. Tree keyboard commands: arrows, Home/End, Enter, Space selection, F2 rename, Shift+F10/context-menu key. Shared menus handle focus/dismissal.

Boundaries and limitations

Permanent containment is separate from sensory/travel relationships and SceneAssetLocations / asset current location. A vehicle temporarily parked somewhere must not become its permanent child unless the author explicitly chooses that hierarchy. No temporal asset tracking is added. No Context, Maps, Floor Plans, Assets, Characters or Names workspace is redesigned.

Geography confirmations are not regenerated after workspace changes. Existing explicit geography review remains available. Large trees render only expanded branches; card view renders matching cards, with complete descriptions and variable height. There is no card virtualization. See Acceptance.md for measured verification and remaining limitations.