Show/Hide Toggles
How the ope/close blocks work.
Behavior
- Open/close blocks allow tables to be shown/hidden by clicking in a +/- icon in the upper right of a HTML table.
- Javascript is used to implement this behavior.
- Once a block is opened/closed, it remains in that state.
- The open close state is stored in a cookie.
- Defaults states are defined in the settings file.
Usage in Templates
Use the custom Smarty tag toggle_table defined in lib/smarty/plugins/block.toggle_table
- Normally for each block you define both an open and a closed block. The closed block normally has no content (rows) defined. The open block is a set of 'TR' HTML tags that define the block contents.
- The toggle_table normally has the following parameters defined:
- name - block name defining
- type - set to 'open' or 'closed'
- ltag - message tage for the table header
- colspan - number of columns in the table
- pflag - printable flag (normally true)
Javascript
ToDo
- Javascript is used to link the behavoir of the open/closed blocks, so that when you click on the open/close +/- image, then the Javascripts sets the display style (I think) to be either displayable or none. The block names get HTML ids (?) defined for the corresponding open and closed HTML elements.
Defining Default Values
Defaults for the show/hide, e.g. their open/closed state are defined in app/config/Settings.php
Look for the configuration keyword ToggleDefaults
$_CFG[ 'ToggleDefaults' ] = array( 'Document_Main' => 1, 'Document_Classif' => 1, ... );
- The names in the associative array correspond to the names in the HTML template files.
Note that the ToggleDefaults may be missing some entries, meaning that no default is defined (I don't know what happens in this case).
- Items in this array can be overridden for specific customer sites by defining the following in the site settings file:
$_CFG[ 'ToggleDefaults' ][ 'Block_Name' ] => 1; $_CFG[ 'ToggleDefaults' ][ 'AnotherBlock_Name' ] => 0;