Installation


Upgrades


DTC-Xen Installation


DTC-Xen / Dom0 Howtos

DTC-Xen / DomU Howtos

FAQ


DTC Howtos


Manuals


Features


Roadmap


Devel docs


Wiki - i18n


Wiki - Meta


Dev /

Config values of the panel

1. General principle

In admin/tables/config.sql and admin/dtc_db.php add a new SQL field:

    flag_william enum('yes','no') NOT NULL default 'yes',

In your code do:

    fonction example(){
      global $conf_flag_example;
      if ($conf_flag_example){
         $out = "Hey, this is me";
      }else{
         ......
      }
      return $out;
    }

2. Add some config flags in the general config

Edit dtc/admin/inc/dtc_config.php.

See function drawSSLIPConfig() for as example. It shows how to make an SQL table grid editor: the ones with plus and minus buttons for a full table, here showing how to edit the SSL IPs and the ports they use on the table ssl_ips in DTC's DB.

See function drawRenewalsConfig() for as example. It shows how to make a config field table editor object.

The doc for the dtc grid editor is in dtc/shared/drawlib/templates.php

3. Comment

In many occasions, you will need some config values for the control panel. At the very begining of DTC (maybe even before version 0.10), they were all saved in a configuration file. This is boring to edit, and can lead the user to errors.

This is why there's another system. All the configuration variables of the control panel are saved in the "config" table in SQL (exept of course the variables to connect to the SQL database that are saved in dtc/shared/mysql_config.php). This table has a unique row, and will always have only one. At the very begining of the execution of a page, DTC includes autoSQLconfig.php that will load the config values with the getConfig() function.

Each field name is then converted in a global configuration variable prefixed with conf_ so it's easy to recognize it in the code. Here's an example.

In the table config, there is a field called addr_primary_dns. This field is then converted to $conf_addr_primary_dns.

This way, it's very easy to add config options, especialy combined to the template system in the admin/inc/dtc_config.php script.

The doc for the functions is here:

4. Adding values to the configurator

To do this, you have to follow the explanations of how to Adding a field to a SQL table first. Then you should simply edit dtc_config.php and add a call or an option to one of the forms.

Page last modified on May 25, 2010, at 06:30 AM EST