Floor Plans Gallery
Relevant source files
The following files were used as context for generating this wiki page:
The Floor Plans Gallery is a specialized module designed to manage building layouts, architectural drawings, and physical space documentation within the IT Management System. It serves as a centralized repository for various file formats including images, PDFs, and AutoCAD files, providing a hierarchical organization structure tailored for facility management and infrastructure planning.
The module is tightly integrated with the broader system, providing the foundational background images for the Floor Designer and allowing optional links to IT Locations to contextualize equipment placement within physical environments.
Sources: modules/floor_plans/AGENT_NOTES.md:4-6, wiki/Floor-Plans.md:1-5, modules/floor_plans/AGENT_NOTES.md:55-56
Architecture and Data Model
The Floor Plans system utilizes a multi-table schema to support nested categorization and tagging. Data isolation is maintained through a strict multi-tenant model where all records and physical files are scoped by company_id.
Database Schema
The relationship between files, folders, and metadata is illustrated below:
The diagram shows the hierarchical folder structure and the relationship between files and their metadata.
Sources: modules/floor_plans/AGENT_NOTES.md:9-14, modules/floor_plans/AGENT_NOTES.md:49-50
Core Components Table
| Table Name | Purpose |
|---|---|
floor_plans | Stores main file metadata (filenames, MIME types, dimensions, etc.). |
floor_plan_folders | Manages the hierarchical directory tree. |
floor_plan_tags | Stores unique tags available for a company. |
floor_plan_item_tags | Intersection table mapping tags to specific floor plan files. |
Sources: modules/floor_plans/AGENT_NOTES.md:10-14, wiki/Floor-Plans.md:23-26
File Management and Storage
The module supports a wide array of technical and standard document formats with a standard upload limit of 20MB per file.
Supported Formats
- Images: JPEG, PNG, GIF, WebP.
- Documents: PDF.
- CAD: AutoCAD (DWG, DXF, DWF, DWS).
Sources: wiki/Floor-Plans.md:9-10
Physical Storage Logic
Physical files are stored in a company-isolated directory structure: floor_plans/{company_id}/. This ensures that even on the filesystem level, data leakage between tenants is prevented.
The workflow for file ingestion and physical storage.
Sources: modules/floor_plans/AGENT_NOTES.md:17-19, modules/floor_plans/view_detail.php:8-10
User Interface and Interaction
The gallery provides a "gallery-first" experience rather than a standard table-based CRUD interface, though a table view is available via list_all.php.
Interactive Folder Tree
The sidebar features an interactive folder tree that supports:
- Navigation: Filtering the gallery view by folder.
- Management: Creating, renaming, and deleting folders (folders must be empty to be deleted).
- Drag & Drop: Reorganizing the hierarchy by dragging folders into other folders or back to the root.
Sources: modules/floor_plans/gallery_index_view.php:12-25, wiki/Floor-Plans.md:11-15
Gallery Actions
Each file in the gallery is represented as a "card" providing quick access to:
- Detail Preview: A modal or detail page showing the file (using
iframefor PDFs orimgtags for images). - Metadata Editing: Modifying the display name, tags, or IT Location link.
- Movement: Dragging a file card onto a folder in the sidebar to move it.
Sources: modules/floor_plans/view_detail.php:38-52, modules/floor_plans/gallery_index_view.php:143-160, js/floor-plans-gallery.js:1
Integration with Other Modules
Floor Designer
The Floor Plans module acts as the "data layer" for the Floor Designer. When creating a designer layout, users select a record from floor_plans to serve as the background interactive canvas.
// Background image resolution in Floor Designer
if (!empty($data['floor_plan_id'])) {
$fpq = mysqli_query($conn, "SELECT stored_filename, company_id FROM floor_plans WHERE id=" . (int)$data['floor_plan_id'] . " AND company_id=" . (int)$company_id);
if ($fpr = mysqli_fetch_assoc($fpq)) {
$bgUrl = "../../floor_plans/" . (int)$fpr['company_id'] . "/" . $fpr['stored_filename'];
}
}
Sources: modules/floor_designer/index.php:572-578
IT Locations
Files can be optionally linked to an it_location_id. This creates a bi-directional reference where the IT Location detail view can display all floor plans associated with that physical site.
Sources: includes/itm_it_location_linked_floor_plans.php:7-12, wiki/Floor-Plans.md:12
Business Rules and Constraints
- Multi-Tenancy: All operations are strictly scoped by
company_id. - Circular Moves: The system prevents moving a folder into its own subfolders to maintain tree integrity.
- Cleanup: Deleting a folder without moving its files first results in those files becoming "unfiled" records.
- Audit Logging: All insertions, updates, and deletions are recorded via database triggers for compliance.
Sources: modules/floor_plans/AGENT_NOTES.md:21-22, modules/floor_plans/AGENT_NOTES.md:38-41, wiki/Floor-Plans.md:19-20
Conclusion
The Floor Plans Gallery serves as the spatial documentation hub of the IT Management System. By combining hierarchical file management with interactive features and cross-module integrations, it enables administrators to maintain an accurate digital twin of their physical infrastructure, supporting everything from simple document storage to advanced interactive floor design.