Developers/Concepts/Configuration

STATUS: PARTLY IMPLEMENTED (ADMIN&UI MISSING)
RELEASED IN: MILAN


Contents

Config

Configuration deals with the administrative parameters which configure Tinebase and all the Applications. This is in contrast to Preferences which deals with parameters each user prefers.

Configuration is set on different places

  1. config.inc.php absolute core configurations like database connection and logging. Needs filesystem access and a text editor.
  2. setup.php core configurations for hosters like mail and ldap. Needs Setup login credentials.
  3. Admin->Appname->Config admin configurations. Needs Tine 2.0 login and right to set the corresponding config (Mostly 'Appname admin right').

Config Definition

Config definitions are done in PHP code. Each application comes with a Appname_Config class wich defines:

  • name
  • label
  • description
  • type {string|int|dateTime|array|record}
    • type array has a optional contents field to define whats in that numeric indices array (defaults to string)
    • types record and recordSet require a model field to define record types
  • clientRegistryInclude boolean flag if this config should be included in the client registry
  • default value
  • code interceptors on read/set
  • comment translations for name and description

NOTE: Non scalar config types must have their own models!

Config Values

Config values are stored in db config table:

  • id
  • applicationId
  • name
  • value JSON encoded for non scalar values

If a config name/key is present in config.inc.php it overwrites the database value.

Registry

Configs, the user has read rights for are available in the users registy data. For this, the config API gets all config names/keys from the PHP definitions, fetches all values from DB at once and passes them to the code interceptions.

Admin_Frontend_Json

Admin Config is always done via the Admin front end using the two admin APIs:

  • Admin_Frontend_Json::getConfig($appname) gets all definitions and values for given application.
  • Admin_Frontend_Json::setConfig($data) sets all values for given application.

The admin JSON frontend ensures that non scalar data instances a corresponding model via setFromJsonInUsersTimezone.

Admin Configuration Javascript UI

The Admin Config UI is build automatically from the config definitions. To Overwriting/Implementing a custom UI you need to create a panel named Appname.config.configkeyPanel