.. ================================================== .. FOR YOUR INFORMATION .. -------------------------------------------------- .. -*- coding: utf-8 -*- with BOM. .. include:: ../../Includes.txt interception ^^^^^^^^^^^^ Interceptions are admin-defined actions that may take place at certain points during various processes. So if you need to do something extraordinary, you might find the solution here. You just need to know *with what* you want to intercept *when/where*. In order to answer the first question (*with what*) you should know that at certain points in the code you may intercept using PHP, at other points using JavaScript and some allow both. So what follows is a list of possible points when to intercept indicating which intercepts are possible and when that takes place. ================ ============================================ ===== ========== Name Description PHP JavaScript ================ ============================================ ===== ========== PreProcessing before any process takes place yes yes PreAction before any action takes place, after inits yes yes Callback field/column-dependant interception yes no Action before a certain single action (Pre-update) yes no Action after a certain single action (e.g. update) yes no PostAction after a set of actions in one call yes yes PreDisplay before showing any data yes yes PostDisplay after data is shown yes yes PostProcessing after a complete process yes yes ================ ============================================ ===== ========== Reading from top to bottom you can also read how one process is structured. But what is a process? Well, this is difficult to explain as it depends largely on the used data handler. It could be one deletion of an entry. It could be one multiple deletion as well. It could be one validation check for the form and it could also be a combination of validation and submission/creation of an entry. How to specify the interception handlers always follows the same pattern: The name of the interception is an array key holding key-based configuration arrays with all the interceptors. Every interceptor needs to have an **eClass** (the class in Classes/Interception/ or, for Javascript, in Resources/Interception/) defined. If both PHP and JS are allowed, then also **eType** (either *php* or *js*) is needed. Other settings vary from interceptor to interceptor. Callback -------- Interceptors here need the field/column to be defined as **sField** and have two more boolean options to tell if the callback shall be applied when a values is going inwards (toward the data source), outwards (to the data handler) or both: - **bInwards** set to true indicates to apply this callback after form validation - **bOutwards** set to true tells to apply this callback right before displaying Action ------ As this applies after a certain single action, the single action after which it should apply, has to be named. Therefore the parameter **sAction** is obligatory. If you want an action interceptor to be called before a certain action, prefix the **sAction** with **Pre-**. Hence, the following two examples are both called, one before, one after the updating process: - **Pre-update** might change the form data before saving it to the database - **update** may update another table as well Examples -------- This is a complete interception configuration: :: 'interception' => array( 'PreProcessing' => array(), 'PreAction' => array(), 'Callback' => array( 10 => array( 'sField' => 'password', 'bInwards' => false, 'bOutwards' => true, 'eClass' => 'Passwordify' ) ), 'Action' => array( 10 => array( //sorting 'eClass' => 'Email', 'sAction' => 'update', 'sRecipient' => 'abc@foo.bar, def@foo.bar', 'sSubject' => 'Entry updated', 'sMail' => 'The entry named "###name###" has just been updated.', 'sFrom' => 'Admin ' //optional as otherwise the system's default is taken ), 20 => array( 'eClass' => 'ReconfigureIf', 'sAction' => 'Pre-getForm', 'aIf' => array( '###fe_user:username###!=###name###' ), 'aSet' => array( 'data/bEdit' => FALSE ) ) ), 'PostAction' => array(), 'PreDisplay' => array(), 'PostDisplay' => array( 10 => array( 'eType' => 'js', 'eClass' => 'Code', 'sCode' => '$('a.myspeciallinks').tooltip();' ) ), 'PostProcessing' => array() ) Interceptors (eClass) --------------------- The interceptors available at the moment are specific in their function. Thus you cannot (or, better speaking, it won't have any affect) use 'wrong' interceptors at the 'wrong' interception places. The following table lists what is currently available and what it is for. ============================== ===== ===== ===== ====== ===== ==== ===== ===== =========================== eClass PreP PreA Callb Action PostA PreD PostD PostP Description ============================== ===== ===== ===== ====== ===== ==== ===== ===== =========================== AggregateToBarChart no no yes no no no no no use in detail view; finds all similar data and calculates a bar chart from them AggregateToList no no yes no no no no no use in detail view; finds all similar data and lists them Calculate no no yes yes no no no no calculate with values ClearCache no no no yes no no no no clear cache for page(s) Code yes yes no no yes yes yes yes execute JavaScript code CountSubEntries no no yes no no no no no counts related entries CreateId no no yes no no no no no create unique ID (auto-increment) CsvImport (yes) (yes) no no (yes) (yes) yes (yes) enable CSV importer DeletionBasedOnRowData no no no yes no no no no prohibit certain rows from deletion Email no no no yes no no no no send email ListSubEntries no no yes no no no no no list related entries Lookup no no no yes no no no no fill field during form input with value based on other field Passwordify no no yes no no no no no mask output (with asterisks) ReconfigureIf yes yes yes yes yes yes yes yes reconfig. setup based on certain conditions ReplaceMarkerWithImages no no yes no no no no no use image uploads in text RewriteEditLinkBasedOnRowData no no no yes no no no no different edit links per row String no no yes yes no no no no prepare/change a certain string (a bit like calculate but for strings) Timestamp no no yes no no no no no prepare a UNIX timestamp as a date UpdateField no no no yes no no no no update another field within the same table UpdateTable no no no yes no no no no update another field within a different database/table ============================== ===== ===== ===== ====== ===== ==== ===== ===== =========================== ² indicates JavaScript interceptors. Moreover, a "yes" in brackets ("(yes)") indicates a technical yes but without much sense. And here you find the handler-specific configuration: .. toctree:: :maxdepth: 1 :titlesonly: :glob: AggregateToBarChart/Index AggregateToList/Index Calculate/Index ClearCache/Index Code/Index CountSubEntries/Index CreateId/Index CsvImport/Index DeletionBasedOnRowData/Index Email/Index ListSubEntries/Index Lookup/Index Passwordify/Index ReconfigureIf/Index ReplaceMarkerWithImages/Index RewriteEditLinkBasedOnRowData/Index String/Index Timestamp/Index UpdateField/Index UpdateTable/Index