EDM System: Developer Documentation

Current version: 2.2.0

Please, read user documentation and administrator documentation before this developer documentation in order to understand some basic concepts.

Building from source

The simplest way to build the software is to run build-release.sh (build-release.cmd for Windows) command, and then you can run ./edm (edm.exe for windows) app in the current directory. These scripts produce a smaller executable with some flags.

You can manually run go build in the cmd/edm directory, then move cmd/edm/edm (cmd\edm\edm.exe for windows) executable two directories up, and then run it from the root project directory.

You should have the Go compiler and a C compiler (like one supplied with GCC or MinGW) on your system installed.

Dockerfile and docker-compose.yml files are available to run the software with Docker.

addicon.cmd is for adding the program icon into the exe file in Windows - this requires Resource Hacker on your system.

run-unix.sh is a more convenient way to run the software while developing it.

In order to know some constants and structs of the app read the package documentation available in the source files, for example with go doc --all command.

All compilers, interpreters, executables which are necessary to build the software should be available in the path variable of your environment.

Python code generation

If you require to use more configuration options as environment variables you can edit config-env.py from the internal/config directory. The file has the predefined list of prefixes for environment variables. For instance, you can set it to [""] in order to make all config options available as environment variables.

If you add some structs which require creating tables in a database, you can run go generate command from the internal/core directory to launch sql-gen.py python script to create sql scripts. This runs python3 and requires it to be installed on your system.

If you modify server config code, you can run go generate command from the internal/config directory to launch config-gen.py and config-env.py python scripts to rewrite config loading and saving functions. This runs python3 and requires it to be installed on your system.

View pages as JSON

The program can display a response in JSON format. It is applicable for almost any page. This might be useful for connecting this server to other services.

To load a page as JSON use the following key and value in GET or POST request: api=json.

Themes

Any theme is a single css file (except which name starts with system- prefix) and which is located in the static/themes directory.

To add a new theme you just need to create that file with selectors like in other files and place it in the static directory. After restarting of the server, the new theme will appear on the settings page.

Localization

There are two JSON files that contain language-specific strings. Name of these files is two-letter language code and .json extension. Server-side files are located in the i18nserver directory, and they are relatively small as they are used only for login page and email notifications. Frontend localization files are located in the static/i18n directory, and they contain a lot more strings, almost all user interface language. Users can easily switch their interface language on the settings page.

To add a new language you need to create those two JSON files with the same structure as existing ones. You need to edit codesui.js file to add a language name there and restart the server.

© 2023 EDM Project