Custom Attributes
Custom Attributes
Executive Summary
The custom attributes functionality -- available to ancestor administrators within the Module Configuration file of all CentralPoint modules -- allows administrators to insert new fields or re-arrange current module layout within the console without requiring a synch process. The changes effectively occur real-time, after administrators upload their new custom attributes XML file. The process to produce these changes is outlined here, as is the structure of the document required to affect these changes.
The custom attributes functionality supports only Centralpoint-specific XML attributes, which allow administrators to add and manipulate form elements, data types and console user interface. Those controls -- and their functionalities -- are listed here.
Chapters
Document Structure
Control functionality and examples
Uploading custom controls
The XML attributes document that controls module layout within the console -- and allows administrators to add fields to their modules -- is comprised by six major XML nodes: group, property, value, attribute, control and validator.
A group functions as a separate tab of form elements within the CentralPoint administrative console. Many of CentralPoint's modules, such as Forms and Design, include multiple tabs for easier administrator interface. A group attribute takes two required parameters: id and name. The value of each of these should be identical for organizational purposes, and they must be alpha-numeric, beginning with a letter. Spaces and special characters are not allowed.
Example:
<group id="Workflow" name="Workflow">
...
</group>
The property node is effectively a field in your module's database design. It takes one parameter: id, the value of which must be alpha-numeric, beginning with a letter. Spaces and special characters are not allowed. Additionally, no two property nodes can have the same id.
A group is comprised of one or more property nodes, and property nodes are comprised of the value, attribute, control and validator nodes.
Example:
<group id="Workflow" name="Workflow">
<property id="UserEmail">
...
</property>
<property id="IncludeFormData">
...
</property>
</group>
A value node sets the default value of a property (or database field) when andministrator creates a new record in the console's module interface. The value node is required to be present in the configuration document, but it is not required to contain a value.
Examples:
(With a value):
<property id="UserEmail">
<value>01</value>
...
</property>
(Without a value):
<property id="UserName">
<value />
...
</property>
The attribute node determines a label in the console's module interface, as well as whether the associated control is visible and if Cp:scripting is allowable in the form element. Those parameters are:
name - Alpha-numeric, with spaces and special characters allowed
isEnabled - true/false
isVisible - true/false
allowScripts - true/false
Example:
<attribute name="User Name" isEnabled="true" isVisible="true" allowScripts="true">
...
</attribute>
Attribute nodes are comprised of a single control, which determines the form element in the console and data type of the field in the module database.
There are 19 possible control types. Control types are comprised of controlproperty nodes that govern the display of the control itself. Control types can also be validated by one or more validator nodes. Below are the control types and a brief description of what they do. A full list of code examples can be found in the Control Functionality and Examples chapter.
- CpAttributeSwitch - Dynamically toggle the display of existing attributes. It is recommended that you set the visiblity of all initally unselected controls to false. This control may cause attributes hidden using module configurations to appear.
- CpAudienceSelector - audience multiselect
- CpColorPicker - color picker
- CpDataListBox - data list box (A custom list box populated using data displayed on the selected Navigation Item.)
- CpDateTimePicker - Date and Time selector
- CpEditor - RTF editor
- CpHyperlink - An uneditable field containing a linked image or text.
- CpKeywordListBox - A list box populated using the selected Keyword List, available in Development > Keyword Lists
- CpKeywordRadioButtonList - A list of radio buttons populated using the selected Keyword List, available in Development > Keyword Lists
- CpListBox - A list box populated from any SQL table.
- CpModuleListBox - A radio button list box of available modules in the console
- CpRadioButtonList - A radio button list populated from any SQL table.
- CpTaxonomySelector - The standard taxonomy selector
- CpTextArea - a standard text area that does not allow RTF control
- CpTextBox - a standard text box
- CpTieredSelector - Tiered selectors dynamically populated using a SQL table with a parent field.
- CpTimeZoneListBox - a standard time zone rop-down menu
- CpUpload - a standard file upload button and its associated functionality
- CpXmlListBox - A list box populated using the given XML file.
Examples:
<attribute name="Confirmation Email" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpAttributeSwitch" type="Centralpoint.Web.UI.Controls.CpAttributeSwitch">
<controlProperty name="RepeatDirection" value="Horizontal" />
<controlProperty name="RepeatColumns" value="0" />
<listItem value="01:" index="0">No</listItem>
<listItem value="02:cfrUserName|cfrTo|cfrFrom|cfrCC|cfrBCC|cfrSubject|cfrBody|cfrIncludeFormData" index="1">Yes</listItem>
</control>
...
</attribute>
<attribute name="User Name" isEnabled="true" isVisible="true" allowScripts="true">
<control id="CpTextBox" type="Centralpoint.Web.UI.Controls.CpTextBox">
<controlProperty name="Width" value="" />
<controlProperty name="AllowCopy" value="true" />
<controlProperty name="TextMode" value="SingleLine" />
<controlProperty name="ReadOnly" value="false" />
<controlProperty name="MaxLength" value="256" />
<controlProperty name="ToolTip" value="" />
</control>
</attribute>
As previously mentioned, control types can be checked using validator nodes. Validator nodes require two parameters: id and type. The id must be a unique, alpha-numeric value that does not contain spaces or special characters. The type must be one of the supported types below. Validator nodes also take controlproperty nodes that govern the error message that display if a form element does not pass validation, as well as patterns that the validator will use to verify the form element.
- CpCompareValidator - Enter either an attribute with which to compare values, or a static value to check before submission.
- CpIdCompareValidator - Compare the control value to the DataId.
- CpLengthValidator - Validates that the length of the controls string value.
- CpRegularExpressionValidator - evaluates and verifies that the form element matches the regular expression
- CpRequiredFieldValidator - checks to ensure the form element contains a value
- CpUniqueFieldValidator - Prevents records with duplicate field values.
Examples:
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
<validator id="PatternCpRegularExpressionValidator" type="Centralpoint.Web.UI.Controls.CpRegularExpressionValidator">
<controlProperty name="Pattern" value="Email" />
<controlProperty name="ErrorMessage" value="" />
</validator>
CpAttributeSwitch
<property id="ContentType">
<value>02</value>
<attribute name="Content Type" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpAttributeSwitch" type="Centralpoint.Web.UI.Controls.CpAttributeSwitch">
<controlProperty name="RepeatDirection" value="Horizontal" />
<controlProperty name="RepeatColumns" value="0" />
<listItem value="01:cfrContentHtml" index="0">HTML</listItem>
<listItem value="02:cfrContentText" index="1">Plain Text</listItem>
</control>
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
</attribute>
</property>
The attribute switch works in conjunction with more than one attribute further down in your XML configuration document. Notice the example above indicates the value of the listItems as cfrContentHtml and cfrContentText. Each attribute to which you refer in your attribute switch must be prefixed with the "cfr" notation. The "Advertisers" module and the "Forms" module have good examples of this item.
CpAudienceSelector
<property id="Audiences">
<value>bf7bb52f-eae7-4d5a-bd20-6849d0260c80</value>
<attribute name="Audiences" isEnabled="true" isVisible="true" allowScripts="false">
<headerText>Audiences will be used for console filtration only</headerText>
<control id="CpAudienceSelector" type="Centralpoint.Web.UI.Controls.CpAudienceSelector" />
</attribute>
</property>
Take note that there is a headertext node in this property. It determines text that will appear just above the audience selector control within the console. Nearly every module in the console contains an audience selector.
CpColorPicker
<property id="BackgroundColor">
<value>#FFFFFF</value>
<attribute name="Background Color" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpColorPicker" type="Centralpoint.Web.UI.Controls.CpColorPicker">
<controlProperty name="ToolTip" value="" />
</control>
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
</attribute>
</property>
CpDataListBox
<property id="SiteMapItems">
<value />
<attribute name="Navigation Items" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpDataListBox" type="Centralpoint.Web.UI.Controls.CpDataListBox">
<controlProperty name="FilterAudiences" value="true" />
<controlProperty name="FieldsClause" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="SearchableFields" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="NoResultsText" value="No records were found." />
<controlProperty name="SelectionMode" value="Multiple" />
<controlProperty name="NavigationItemSystemName" value="SiteMap" />
<controlProperty name="EmptyItemText" value="" />
<controlProperty name="TableName" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="ScrollHeight" value="171" />
<controlProperty name="ShowHeader" value="false" />
<controlProperty name="JoinClauses" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="Columns" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="WhereClause" value="" />
<controlProperty name="ShowSearch" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="OrderByClause" value="[cp:placeholders key='InheritValue' /]" />
<controlProperty name="PageSize" value="100" />
</control>
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
</attribute>
</property>
A data list box is typically used to display site map items from the Site Architecture > Navigation module.
CpDateTimePicker
<property id="StartDate">
<value />
<attribute name="Publish Start Date">
<control id="CpDateTimePicker" type="Centralpoint.Web.UI.Controls.CpDateTimePicker">
<controlProperty name="Accuracy" value="Second" />
</control>
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
</attribute>
</property>
CpEditor
<property id="ContentHtml">
<value />
<attribute name="Content" isEnabled="true" isVisible="true" allowScripts="true">
<control id="CpEditor" type="Centralpoint.Web.UI.Controls.CpEditor">
<controlProperty name="UploadsSubFolder" value="" />
<controlProperty name="AllowResources" value="true" />
<controlProperty name="Configuration" value="Default" />
<controlProperty name="Height" value="" />
</control>
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
</attribute>
</property>
CpHyperlink
<property id="ViewPages">
<value>Click here to view all associated article pages.</value>
<attribute name="View Associated Pages" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpHyperLink" type="Centralpoint.Web.UI.Controls.CpHyperLink">
<controlProperty name="Target" value="" />
<controlProperty name="NavigateUrl" value="/Console/Module.aspx?sn=PubPages&keywords={0}&match=Phrase&fields=cprel_PubPages.Article" />
<controlProperty name="ImageUrl" value="" />
<controlProperty name="NavigateUrlReplacementTextControlPath" value="../../../../../cfProperties/cfrDataId/clblDataId" />
<controlProperty name="ToolTip" value="" />
</control>
</attribute>
</property>
CpKeywordListBox
<property id="State">
<value />
<attribute name="State" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpKeywordListBox" type="Centralpoint.Web.UI.Controls.CpKeywordListBox">
<controlProperty name="KeywordListId" value="ef96d94f-5a0f-4a72-a776-843bb32348a9" />
<controlProperty name="PleaseSelect" value="Please Select..." />
<controlProperty name="SelectionMode" value="Single" />
<controlProperty name="ToolTip" value="" />
</control>
</attribute>
</property>
CpKeywordRadioButtonList
<property id="AutoUpdateGeoCodes">
<value>1</value>
<attribute name="Auto Update Geo Codes" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpKeywordRadioButtonList" type="Centralpoint.Web.UI.Controls.CpKeywordRadioButtonList">
<controlProperty name="KeywordListId" value="c52d9d0d-09f4-4547-96b0-0850f7fade47" />
<controlProperty name="RepeatDirection" value="Horizontal" />
<controlProperty name="RepeatColumns" value="0" />
</control>
</attribute>
</property>
CpListBox
<property id="Roles">
<value>87d65c27-6e78-4e5c-b423-78d47d4f2768</value>
<attribute name="Roles">
<control id="CpListBox" type="Centralpoint.Web.UI.Controls.CpListBox">
<controlProperty name="SelectionMode" value="Multiple" />
<controlProperty name="TableName" value="cpsys_Roles" />
<controlProperty name="TextField" value="dbo.cpsys_Roles.[Name]" />
<controlProperty name="ValueField" value="dbo.cpsys_Roles.RoleId" />
<controlProperty name="Filter" value="dbo.cpsys_Roles.IsDataRole = 1" />
<controlProperty name="PrefixFields" value="false" />
</control>
</attribute>
</property>
CpModuleListBox
No sample available
CpRadioButtonList
No sample available
CpTaxonomySelector
<property id="Taxonomy">
<value />
<attribute name="Taxonomy">
<control id="CpTaxonomySelector" type="Centralpoint.Web.UI.Controls.CpTaxonomySelector" />
</attribute>
</property>
CpTextArea
<property id="ContentText">
<value />
<attribute name="Content" isEnabled="true" isVisible="true" allowScripts="true">
<control id="CpTextArea" type="Centralpoint.Web.UI.Controls.CpTextArea">
<controlProperty name="ToolTip" value="" />
<controlProperty name="ReadOnly" value="false" />
<controlProperty name="Wrap" value="true" />
<controlProperty name="Height" value="295" />
</control>
<validator id="CpRequiredFieldValidator" type="Centralpoint.Web.UI.Controls.CpRequiredFieldValidator" />
</attribute>
</property>
CpTextBox
<property id="CpScript">
<value />
<attribute name="CpScript" isEnabled="true" isVisible="true" allowScripts="false">
<control id="CpTextBox" type="Centralpoint.Web.UI.Controls.CpTextBox">
<controlProperty name="Width" value="" />
<controlProperty name="AllowCopy" value="true" />