Developers

Requirements

dobrado is written in PHP and Javascript, and requires a MySQL database. The following instructions assume you have already set up a web server and created a database for dobrado. Get the latest version of the software from gitlab.com, if you have any problems setting it up please also make an account there and report the issue.

Configuration

You should clone dobrado to the web directory it will be running from, note that dobrado doesn't currently support being run from a subdirectory. Next edit the file php/functions/db_config.php with the details for the database you just created. Once this is done, point your browser at php/start.php which will create the required database tables and directory structure. When this has completed, dobrado will return to the root directory of the domain name you provided in the url. You should see a login form and be able to log in with username: admin, password: admin. If this doesn't happen or you see a blank page, consult your web server's log file.

Directory Structure

dobrado core files are stored under the php and js directories. Most of the php files immediately under the php directory are directly accessed via POST requests client side javascript. The functions directory stores generic code used across the code base. The modules directory is the install target used by the installation system and gives dobrado it's extensibility. Modules provide their own callbacks that are accessed via php/request.php.

Modules

dobrado is a modular system, where modules are made up of three files: a php file, a minified javascript file and a source javascript file. Before installation, all three of these files will be found under the install directory with the naming convention: Label.php, dobrado.label.js and dobrado.label.source.js. When a module is installed these files are copied to php/modules, js and js/source respectively. The installer renames dobrado.label.source.js to dobrado.label.js to match it's minified counterpart, and concatenates minified javascript files for production.

The installer also rewrites php/instance.php to include the new module, which makes it available via the auto loader. Modules can also provide external css files, if the installer finds a css file in the install directory, it will be copied to the css directory and concatenated to 3rdParty.css.

All modules must implement the methods required by the abstract base class, php/modules/Base.php. To help you get started here's a skeleton file you can copy to start your own module: php/modules/Skeleton.php, there's also js/source/dobrado.skeleton.js. The benefit of writing a module that extends the Base class is that core dobrado code already knows how to call methods belonging to your module. You also get the benefit of the many helper functions listed in the Base class as protected functions. The core javascript code also provides many helper functions in js/source/core.js, these are prefixed with dobrado. just like your own module.

Development

When working on modules, you will want to edit files where you can test your changes, which means files under php/modules and js/source. Because these files aren't tracked by git, you will need to copy them back to the install directory to save your changes. To do this, you can run install.sh. It will diff the directories and copy back all changes you've made. It will also minify your javascript source files, you will need to install jsmin to do this.