The Document Management System in Comserv provides a flexible and powerful way to manage documentation files. It automatically discovers, routes, and serves documentation files from the Documentation directory.
The system is built around the Comserv::Controller::Documentation
controller, which handles
all aspects of document management including file discovery, routing, and rendering.
When the application starts, the Documentation controller scans the root/Documentation
directory
for all files. It processes both template files (.tt) and other file types (JSON, HTML, images, etc.).
For each file found, the controller creates a route that allows the file to be accessed via a URL.
For example, a file named user_guide.tt
would be accessible at /Documentation/user_guide
.
Routes are generated dynamically based on the files found in the Documentation directory. The controller uses several mechanisms to ensure that routes are valid and don't conflict with existing routes:
The controller serves different types of content appropriately:
Adding new documentation is simple:
root/Documentation
directoryTemplate files should include the PageVersion information at the top:
This helps track the file version and location, and is displayed when debug mode is enabled.
The Documentation Index page (/Documentation
) provides a comprehensive list of all available
documentation pages. It organizes the pages alphabetically and provides links to each page.
The index is generated dynamically based on the files found in the Documentation directory, so it's always up-to-date with the latest documentation.
The Documentation controller implements several key methods:
It also includes explicit routes for common documentation pages to ensure they're always available even if the files don't exist yet.
The system includes robust error handling: