View XML
1. View XML
All views used by system are defined in XML files. Every plugin has one or more xml files which contains definition of views used by this plugin. Every file can contain only one view definition.
1.1 file structure
<?xml version="1.0" encoding="UTF-8"?> <view xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schema.qcadoo.org/view" xsi:schemaLocation="http://schema.qcadoo.org/view http://schema.qcadoo.org/view.xsd" name="name" modelName="modelName" modelPlugin="modelPlugin" menuAccessible="menuAccessible" defaultAuthorizationRole="ROLE_defaultAuthorizationRole" windowWidth="windowWidth" windowHeight="windowHeight" > // HERE YOU PUT COMPONENT DEFINITIONS // HERE YOU PUT HOOKS </view>
Where:
- pluginIdentifier - is an identifier of plugin corresponding to this view definitions
- name - is an identifier of view (required)
- modelName - defines model corresponding to this view (optional, default value: none)
- modelPlugin - defines plugin identifier of model. (optional, default value: current plugin)
- menuAccessible - defines if view can be available from menu (optional, default value: false)
- defaultAuthorizationRole - defines default role necessary to access this view. Values can be one of roles defined for application. (optional, default value:
ROLE_USER
) - windowWidth - defines view width (in px) when opened as modal (optional, default value: 600)
- windowHeight - defines view height (in px) when opened as modal (optional, default value: 400)
1.2 component definition
Component definition must match pattern:
<component type="componentType" name="componentName" reference="referenceName" basicOptions> // HERE YOU PUT COMPONENT CONTENT // HERE YOU PUT ADDITIONAL OPTIONS // HERE YOU PUT LISTENERS // HERE YOU PUT SCRIPT </component>
Where:
- componentType - defines type of component
- componentName - is an identifier of plugin corresponding to this view definitions
- referenceName - reference name of component. It can be used to access component in scripts, listeners or hooks.
- basicOptions - here you put basic component options in form key="value".
Structure of component content and options depends on component. Basically additional option has structure:
<option type="optionType" value="optionValue" />
Listeners and script has the same structure for every component (see 'scripts section' or 'hooks and listeners' )