wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
configuration.doxy
Go to the documentation of this file.
1 /** @page configuration
2  *
3  * @section configuration Configuration
4  *
5  * The application is configured via one (or more) configuration file(s), which are parsed by the
6  * WCMFInifileParser class. The configuration parameters are defined by key-value pairs as they are
7  * used in the @em ini file format. The application interprets values, which are enclosed in curly brackets
8  * (@em {}), as arrays. Related parameters are arranged in sections.
9  * @note Please note, that the framework interprets paths - if not explicitly indicated otherwise - as relative
10  * to the BASE path, which is defined in /application/base_dir.php. This is the root directory of /wcmf
11  * and /application by default.
12  *
13  * - @ref actionkey
14  * - @ref userconfig
15  * - @ref sections
16  * - @ref configexample
17  *
18  * @subsection actionkey Action Keys
19  *
20  * An important concept of the application's configuration is that of @em Action @em Keys. An action key
21  * describes the state of the application together with the action to be performed next. The state, which
22  * the application is in, results from the current controller and the context, in which it is executed.
23  * Controllers must exist as classes, whereas contexts and actions can be defined freely. They must only be
24  * taken care of in the controllers and if necessary transported between the views (as form data, see also
25  * @ref howtoapplication, @ref howtoviews).@n
26  * The format of the action keys is the following:
27  *
28  * @verbatim controller?context?action @endverbatim
29  *
30  * In the configuration file an action key has the controller assigned, which should be executed next if
31  * the action key is valid by the application's current state and the user action or the return value of
32  * the current controller (see also @ref applicationflow).@n
33  * Since parts of the action key can be omitted in the definition, an algorithm has to choose,
34  * which action key fits a given value triplet. This algorithm is implemented in the method
35  * WCMFInifileParser::getBestActionKey. In this method the %InifileParser searches in the configuration
36  * file for the a list of combinations successively and ends the search when it found one. After
37  * that the controller, which is assigned to that combination, is executed. The order of the combinations
38  * is the following:
39  *
40  * @verbatim
41  1. controller?context?action
42  2. controller??action
43  3. controller?context?
44  4. ?context?action
45  5. ??action
46  6. controller??
47  7. ?context? @endverbatim
48  *
49  * As a rule of thumb the action key which describes the state of the application the most
50  * accurate is favoured.@n
51  * Frequent examples are:@n@n
52  *
53  * Always execute the %SaveController when action @em save is selected, no matter which state the application is in:
54  * @verbatim ??save = SaveController @endverbatim
55  *
56  * Always execute the %ProjektController when the context is @em project as long as no action is specified,
57  * return to the ProjektController respectively from all controllers, which have no specific action assigned
58  * upon termination:
59  * @verbatim ?project? = ProjectController @endverbatim
60  *
61  * If no matching action key can be found, the %ActionMapper tries to execute the last %Controller that had a view attached again.
62  * This can save some typing. For example you don't need to configure an action key for the @em ok return action of
63  * SaveController, if you always want to execute the %Controller afterwards, from which the @em save action was initiated.
64  *
65  * @subsection userconfig Configuration for individual users
66  *
67  * In the table @em user of the database scheme (see also @ref dbschema) each user can have her own configuration
68  * file assigned. This will be loaded after the standard configuration (config.ini) and extends its settings.
69  * If two keys have the same name the one from the user configuration overwrites the standard one. Using the @em roleconfig
70  * configuration section, you can easily asign configuration files to groups (see below).
71  *
72  * @subsection sections Configuration file sections
73  *
74  * The following sections are known to the framework classes. Whatever parameter is necessary for the application
75  * can be defined in further sections and can be read using the methods of the WCMFIniFileParser.
76  *
77  * @subsubsection secconfig [config]
78  * This section refers to the configuration files. The following keys are known to the framework::
79  * @verbatim
80  include = array with configuration files
81  ; allows the inclusion of further configuration files
82  ; (Included values don't overwrite the current)
83  ; used in: class.InifileParser.php
84  hiddenSections = array with sections
85  ; allows the hiding of sections in the admintool
86  ; used in: class.InifileParser.php
87  readonlySections = array with sections
88  ; allows the protection of sections in the admintool
89  ; used in: class.InifileParser.php
90  @endverbatim
91  *
92  * @subsubsection secclassmapping [classmapping]
93  * Since %Controller, %PersistenceMapper and other classes in the configuration file's sections are only
94  * labeled with their classnames, the framework needs information, in which files the class definitions can be
95  * found. In the section @em classmapping therefore a corresponding definition file for each class is given.
96  * @verbatim classname = path_to/classfilename @endverbatim
97  *
98  * @subsubsection sectypemapping [typemapping]
99  * The relation between domain classes and their PersistenceMappers (see @ref persistence) is set in the
100  * section @em typemapping. A @em * as key means that all types, which are not specified, will be handled by
101  * the assigned %PersistenceMapper. The PersistenceFacade uses these information to find the appropriate
102  * %PersistenceMapper classes for the domain classes.
103  * @verbatim type = mapperClass @endverbatim
104  *
105  * @subsubsection secimplementation [implementation]
106  * In some cases the framework offers different implementations for abstract classes. At the moment this refers
107  * to basic services, which access the data storage (database, XML), e.g. AuthUser. The implementation, which
108  * should be used by the framework can be specified in this section. For the following classes an implementation
109  * can be chosen:
110  * @verbatim
111  LockManager = LockManagerRDB|BusyLockManager|NullLockManager
112  UserManager = UserManagerRDB|UserManagerXML
113  User = UserRDB|UserXML
114  Role = RoleRDB|RoleXML
115  UserRole = NMUserRole
116  View = View|NullView
117  ControlRenderer = DefaultControlRenderer
118  ValueRenderer = DefaultValueRenderer
119  HTMLFormat = HTMLFormat
120  JSONFormat = JSONFormat
121  SOAPFormat = SOAPFormat @endverbatim
122  * Furthermore this mechanism allows developers to provide own implementations of the abstract classes.
123  *
124  * @subsubsection secinitparams [initparams]
125  * Since some classes require specific parameters in their constructors (e.g. database connection),
126  * these parameters can be grouped in sections (e.g. @em [database]) and referenced in the section
127  * @em initparams. The keys are the classnames and the values the corresponding parameter sections.
128  * The key-value pairs of the parameter section will be passed as associative array to the constructor
129  * upon creation of the objects.
130  * @verbatim class = initsection @endverbatim
131  *
132  * @subsubsection secconverter [converter]
133  * In this section DataConverters for types are configured (see @ref persistence):
134  * @verbatim type = converterClass @endverbatim
135  *
136  * @subsubsection secactionmapping [actionmapping]
137  * In the section @em actionmapping the actual application flow is defined. This is achieved by defining
138  * the transition from one controller to the next.@n
139  * The key is an action key (see @ref actionkey), which clearly describes the state the application is
140  * in before the transition. The value sets the next controller to execute. The ActionMapper uses this
141  * information to determine which Controller is executed next.
142  * @verbatim controllerA?context?action = controllerB @endverbatim
143  *
144  * @subsubsection secviews [views]
145  * For each controller a view can be defined dependent on its context and action, which is described
146  * by its Smarty template (.tpl file). In the section @em views each action key can have a view template
147  * assigned (see @ref actionkey). The controller uses this information to determine its view.
148  * @verbatim controllerA?context?action = view @endverbatim
149  *
150  * @subsubsection secauthorization [authorization]
151  * The Authorization is based on action keys (see @ref actionkey), whereby the following actions can be
152  * defined by the individual parts of the key:
153  * @verbatim
154  controller?context?action ; an action in the application flow
155  type?context?action ; an action on a domain class (read, modify, delete, create)
156  oid?context?action ; an action on a domain object (read, modify, delete, create) @endverbatim
157  * To each of these actions different roles can be assigned (comma separated), for which a permission
158  * is granted (@em +) or denied (@em -). The role @em * stands for all roles.@n
159  * If a permission is not explicitly granted, it is considered as denied. For not listed Aktion Keys the
160  * decision is made by the _defaultPolicy of the AuthUser. The RightsManager uses this information to
161  * authorize an AuthUser for an action.
162  *
163  * The following code shows an example, where the creation of Category instances is only allowed for users having
164  * the @em administrators role:
165  * @verbatim Category??create = -authors +administrators @endverbatim
166  *
167  * @subsubsection secroleconfig [roleconfig]
168  * Allows auto assignment of an additional configuration file for different user roles. If a user is added
169  * to a listed role, then the given configuration file will be automatically assigned by the UserManager
170  * (see also @ref userconfig).
171  * @verbatim rolename = configurationfile @endverbatim
172  *
173  * For example if users of the @em administrators role should always use the admin.ini configuration file
174  * you could add the following entry:
175  * @verbatim administrators = admin.ini @endverbatim
176  *
177  * @subsubsection seccms [cms]
178  * This section refers to the general application configuration. The following keys are known to the framework::
179  * @verbatim
180  applicationTitle = application title
181  ; specifies the title which appears in the default application
182  ; used in: class.Controller.php, locale.php
183  rootTypes = array of domain classes
184  ; declaration of types, which don't have parent types to allow them to be created
185  ; on the top level of the default application
186  ; used in: class.DisplayController.php, class.TreeViewController.php,
187  ; class.XMLExportController.php, graph.php
188  anonymous = 0|1
189  ; indicates, if the user must authenticate himself upon application start.
190  ; If the value is 1 the rights management is also disabled.
191  ; used in: class.LoginController.php, class.RightsManager.php
192  exportDir = path (relative to main.php !)
193  ; sets the root directory for the export of static pages
194  ; used in: class.PageExportController.php
195  htmlBaseDir = path (relative to main.php !)
196  ; sets the root directory for the html output
197  ; used in: class.LinkConverter.php
198  backupDir = path (relative to main.php !)
199  ; sets the root directory for backups
200  ; used in: class.BackupController.php
201  libDir = path (relative to main.php !)
202  ; sets the root directory of the framework
203  ; used in: class.TreeViewController.php, resource.lib.php, class.FormUtil.php
204  localeDir = path (relative to main.php !)
205  ; sets the language directory of the application
206  ; used in: main.php, class.I18nUtil.php, po2array.php
207  logDBActions = 0|1
208  ; specifies, whether database access should be logged in the logfile
209  ; used in: main.php
210  logSQL = 0|1
211  ; specifies, whether the logging of the database layer is activated
212  ; ADOdb then logs all access in the table adodb_logsql
213  ; used in: class.NodeRDBMapper.php, class.NodeToSingleTableMapper.php,
214  ; class.LockManagerRDB.php, class.AuthUserRDB.php, class.UserManagerRDB.php
215  logExecuteTime = 0|1
216  ; specifies, whether to log the time each controller needs to execute
217  ; used in: class.ActionMapper.php
218  debugView = 0|1
219  ; specifies, whether Smarty should create debug output in a popup window
220  ; used in: class.Controller.php
221  language = language code (e.g. en_EN)
222  ; specifies the application's language (see Message::get)
223  ; used in: main.php, locale.php
224  usegettext = 0|1
225  ; specifies, whether the function gettext should be used for the localization of the
226  ; application (see Message::get).
227  ; used in: class.Message.php
228  locking = 0|1
229  ; specifies, whether data is locked when it's opened by another user
230  ; used in: class.LockManager.php
231  @endverbatim
232  *
233  * @subsubsection sechtmlform [htmlform]
234  * The definition of the input controls, that are used in the application,
235  * is done in Smarty templates (see @ref DefaultControlRenderer). In this section the templates
236  * are assigned to control names.@n
237  * The following input controls are already defined by the framework:
238  * @verbatim
239  text
240  textarea
241  password
242  select
243  radio
244  checkbox
245  file
246  fileex
247  filebrowser
248  linkbrowser
249  fckeditor
250  date @endverbatim
251  *
252  * Furthermore the following keys are known to the framework:
253  * @verbatim
254  maxFileSize = number
255  ; specifies the maximum size of files to upload (in bytes)
256  ; used in: class.FormUtil.php, class.NodeUtil.php,
257  class.SaveController.php, class.FileUtil.php
258  inputFieldNameDelimiter = char
259  ; specifies the separator, which is used for creation of inputfield names
260  ; (e.g. separator "-": "value-1-name-Author:0")
261  ; used in: class.SaveController.php, class.NodeUtil.php,
262  class.FormUtil.php
263  @endverbatim
264  *
265  * @subsubsection sechtmldisplay [htmldisplay]
266  * The definition of the value display types, that are used in the application,
267  * is done in Smarty templates (see @ref DefaultValueRenderer). In this section the templates
268  * are assigned to value type names.@n
269  * The following value types are already defined by the framework:
270  * @verbatim
271  text
272  image @endverbatim
273  *
274  * @subsubsection secsmarty [smarty]
275  * The @em smarty section contains configuration parameters for the <a href="http://smarty.php.net/" target="_blank">
276  * Smarty</a> Template Engine.
277  * @verbatim
278  compileCheck = 0|1
279  ; specifies, whether Smarty should test for modifications
280  ; in the templates upon each call
281  ; used in: class.Controller.php
282  templateDir = path (relative to main.php !)
283  ; specifies the smarty directory (the paths /smarty/templates_c
284  ; and in case of caching=1 /smarty/cache must exist in that directory)
285  ; used in: class.Controller.php
286  caching = 0|1
287  ; specifies, whether Smarty should use caching
288  ; in case of a cms application caching is a good alternative to exporting
289  ; static pages
290  ; used in: class.Controller.php
291  cacheLifetime = -1|number of seconds
292  ; specifies, the lifetime of the Smarty cache in seconds
293  ; the value is ignored if caching is not enabled
294  ; used in: class.Controller.php
295  @endverbatim
296  *
297  * @subsubsection secmedia [media]
298  * In this section settings for the upload of media files are specified.
299  * @verbatim
300  imgWidth = array of a number and 0|1
301  ; sets - if specified - the width of an upload image
302  ; the second parameter specifies if the value must be matched exactly (1)
303  ; or if it is a maximum (0)
304  ; e.g. {625, 0}
305  ; used in: class.SaveController.php
306  imgHeight = array of a number and 0|1
307  ; sets - if specified - the height of an upload image
308  ; the second parameter specifies if the value must be matched exactly (1)
309  ; or if it is a maximum (0)
310  ; e.g. {625, 1}
311  ; used in: class.SaveController.php
312  uploadDir = path (relative to main.php !)
313  ; specifies the directory, into which the SaveController uploads media files
314  ; used in: class.SaveController.php, class.FormUtil.php
315  @endverbatim
316  *
317  * @subsection configexample Example of a configuration file
318  *
319  * @verbatim
320 
321  [config]
322 
323  [classmapping]
324  BackupController = wcmf/application/controller/admintool/class.BackupController.php
325  AdminController = wcmf/application/controller/admintool/class.AdminController.php
326  ConfigController = wcmf/application/controller/admintool/class.ConfigController.php
327  PrincipalController = wcmf/application/controller/admintool/class.PrincipalController.php
328  EditRightsController = wcmf/application/controller/admintool/class.EditRightsController.php
329  MySQLBackupController = wcmf/application/controller/admintool/class.MySQLBackupController.php
330  BatchController = wcmf/application/controller/class.BatchController.php
331  LongTaskController = wcmf/application/controller/class.LongTaskController.php
332  DeleteController = wcmf/application/controller/class.DeleteController.php
333  DisplayController = wcmf/application/controller/class.DisplayController.php
334  FailureController = wcmf/application/controller/class.FailureController.php
335  InsertController = wcmf/application/controller/class.InsertController.php
336  LoginController = wcmf/application/controller/class.LoginController.php
337  PageExportController = wcmf/application/controller/class.PageExportController.php
338  SimplePagingController = wcmf/application/controller/class.SimplePagingController.php
339  SortController = wcmf/application/controller/class.SortController.php
340  AssociateController = wcmf/application/controller/class.AssociateController.php
341  ResourceTreeController = wcmf/application/controller/class.ResourceTreeController.php
342  PagingController = wcmf/application/controller/class.PagingController.php
343  SaveController = wcmf/application/controller/class.SaveController.php
344  SimpleBatchController = wcmf/application/controller/class.SimpleBatchController.php
345  SimpleLongTaskController = wcmf/application/controller/class.SimpleLongTaskController.php
346  TreeViewController = wcmf/application/controller/class.TreeViewController.php
347  ViewController = wcmf/application/controller/class.ViewController.php
348  XMLExportController = wcmf/application/controller/class.XMLExportController.php
349  CopyController = wcmf/application/controller/class.CopyController.php
350  UserController = wcmf/application/controller/class.UserController.php
351  ResourceListController = wcmf/application/controller/class.ResourceListController.php
352  SearchController = wcmf/application/controller/class.SearchController.php
353  SOAPController = wcmf/application/controller/class.SOAPController.php
354  ChildrenListController = wcmf/application/controller/class.ChildrenListController.php
355  NodeListController = wcmf/application/controller/class.NodeListController.php
356  Controller = wcmf/lib/presentation/class.Controller.php
357  UserRDB = application_1/include/model/wcmf/class.UserRDB.php
358  UserRDBRDBMapper = application_1/include/model/wcmf/class.UserRDBRDBMapper.php
359  RoleRDB = application_1/include/model/wcmf/class.RoleRDB.php
360  RoleRDBRDBMapper = application_1/include/model/wcmf/class.RoleRDBRDBMapper.php
361  NMUserRole = application_1/include/model/wcmf/class.NMUserRole.php
362  NMUserRoleRDBMapper = application_1/include/model/wcmf/class.NMUserRoleRDBMapper.php
363  Locktable = application_1/include/model/wcmf/class.Locktable.php
364  LocktableRDBMapper = application_1/include/model/wcmf/class.LocktableRDBMapper.php
365  Adodbseq = application_1/include/model/wcmf/class.Adodbseq.php
366  AdodbseqRDBMapper = application_1/include/model/wcmf/class.AdodbseqRDBMapper.php
367  LockManagerRDB = wcmf/lib/persistence/class.LockManagerRDB.php
368  UserManagerRDB = wcmf/lib/security/class.UserManagerRDB.php
369  View = wcmf/lib/presentation/class.View.php
370  DefaultControlRenderer = wcmf/lib/presentation/class.DefaultControlRenderer.php
371  DefaultValueRenderer = wcmf/lib/presentation/class.DefaultValueRenderer.php
372  HTMLFormat = wcmf/lib/presentation/format/class.HTMLFormat.php
373  JSONFormat = wcmf/lib/presentation/format/class.JSONFormat.php
374  SOAPFormat = wcmf/lib/presentation/format/class.SOAPFormat.php
375 
376  [typemapping]
377  UserRDB = UserRDBRDBMapper
378  RoleRDB = RoleRDBRDBMapper
379  NMUserRole = NMUserRoleRDBMapper
380  Locktable = LocktableRDBMapper
381  Adodbseq = AdodbseqRDBMapper
382 
383  [implementation]
384  LockManager = LockManagerRDB
385  UserManager = UserManagerRDB
386  User = UserRDB
387  Role = RoleRDB
388  UserRole = NMUserRole
389  View = View
390  ControlRenderer = DefaultControlRenderer
391  ValueRenderer = DefaultValueRenderer
392  HTMLFormat = HTMLFormat
393  JSONFormat = JSONFormat
394  SOAPFormat = SOAPFormat
395 
396  [initparams]
397  UserRDBRDBMapper = database
398  RoleRDBRDBMapper = database
399  NMUserRoleRDBMapper = database
400  LocktableRDBMapper = database
401  AdodbseqRDBMapper = database
402 
403  [converter]
404 
405  [actionmapping]
406  ??fatal = FailureController
407  ??delete = DeleteController
408  DisplayController?? = DisplayController
409  DisplayController??treeview = TreeViewController
410  DisplayController??failure = FailureController
411  DisplayController??definesearch = SearchController
412  DisplayController??list = NodeListController
413  DisplayController??edituser = UserController
414  DisplayController??search = SearchController
415  DisplayController??listchildren = ChildrenListController
416  LoginController??ok = DisplayController
417  UserController??ok = DisplayController
418  ??cms = DisplayController
419  ??display = DisplayController
420  ??new = InsertController
421  LoginController??failure = LoginController
422  LoginController??dologin = LoginController
423  ??login = LoginController
424  ??logout = LoginController
425  SimplePagingController?? = SimplePagingController
426  ??sortup = SortController
427  ??sortdown = SortController
428  ??disassociate = AssociateController
429  ??associate = AssociateController
430  ResourceTreeController?? = ResourceTreeController
431  ??browseresourcetree = ResourceTreeController
432  ??save = SaveController
433  TreeViewController?? = TreeViewController
434  ??copy = CopyController
435  UserController??save = UserController
436  UserController?? = UserController
437  ResourceListController?? = ResourceListController
438  ResourceListController??delete = ResourceListController
439  ??browseresources = ResourceListController
440  SearchController?? = SearchController
441  ??soapList = SOAPController
442  ??soapCreate = SOAPController
443  ??soapUpdate = SOAPController
444  ??soapRead = SOAPController
445  ??soapDelete = SOAPController
446  ChildrenListController?? = ChildrenListController
447  NodeListController?? = NodeListController
448 
449  [views]
450  DisplayController?? = wcmf/application/views/displaynode.tpl
451  FailureController?? = wcmf/application/views/displayfailure.tpl
452  LoginController?? = wcmf/application/views/login.tpl
453  ResourceTreeController?? = wcmf/application/views/resourcetree.tpl
454  TreeViewController?? = wcmf/application/views/treeview.tpl
455  UserController?? = wcmf/application/views/user.tpl
456  ResourceListController?? = wcmf/application/views/resourcelist.tpl
457  SearchController??definesearch = wcmf/application/views/searchpanel.tpl
458  SearchController?? = wcmf/application/views/searchresult.tpl
459  ChildrenListController?? = wcmf/application/views/childrenlist.tpl
460  NodeListController?? = wcmf/application/views/nodelist.tpl
461 
462  [authorization]
463 
464  [roleconfig]
465  administrators = admin.ini
466 
467  [database]
468  dbType = mysql
469  dbHostName = localhost
470  dbName = wcmf
471  dbUserName = wcmf
472  dbPassword = geheim
473 
474  [smarty]
475  templateDir = include/views/
476  compileCheck = 1
477 
478  [cms]
479  applicationTitle = DEFAULT
480  localeDir = locale/
481  libDir = ../wcmf/
482  exportDir = ../../html/
483  htmlBaseDir = ../../html/
484  backupDir = backup/
485  language = en_EN
486  usegettext = 0
487  debugView = 0
488  logDBActions = 0
489  logSQL = 0
490  logExecuteTime = 0
491  anonymous = 0
492  locking = 1
493  rootTypes = {}
494 
495  [media]
496  uploadDir = ../../html/images/
497 
498  [htmlform]
499  inputFieldNameDelimiter = -
500  maxFileSize = 200000
501  text = wcmf/application/views/forms/text.tpl
502  textarea = wcmf/application/views/forms/textarea.tpl
503  password = wcmf/application/views/forms/password.tpl
504  select = wcmf/application/views/forms/select.tpl
505  radio = wcmf/application/views/forms/radio.tpl
506  checkbox = wcmf/application/views/forms/checkbox.tpl
507  file = wcmf/application/views/forms/file.tpl
508  fileex = wcmf/application/views/forms/fileex.tpl
509  filebrowser = wcmf/application/views/forms/filebrowser.tpl
510  linkbrowser = wcmf/application/views/forms/linkbrowser.tpl
511  fckeditor = wcmf/application/views/forms/fckeditor.tpl
512 
513  [htmldisplay]
514  text = wcmf/application/views/display/text.tpl
515  image = wcmf/application/views/display/image.tpl
516 
517  @endverbatim
518  *
519  * Back to the @ref intro | Previous section @ref extensionpoints | Next section @ref dbschema
520  *
521  */