1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
|
<refentry id="vc_template">
<refmeta>
<refentrytitle>template</refentrytitle>
<refmiscinfo>vspx_control</refmiscinfo>
</refmeta>
<refnamediv>
<refname>template</refname>
<refpurpose>Container for a group of controls and/or HTML code.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="vc_syn_template">
<funcprototype id="vc_proto_template">
<funcdef>
<<function>template</function> <attribute>
<parameter>name</parameter> (required) </attribute>
<attribute>
<parameter>annotation</parameter> (optional) </attribute>
<attribute>
<parameter>initial-enable</parameter> (optional) </attribute>
<attribute>
<parameter>enabled</parameter> (optional) </attribute>
<attribute>
<parameter>instantiate</parameter> (optional) </attribute>
<attribute>
<parameter>control-udt</parameter> (optional) </attribute>
<attribute>
<parameter>xsd-stub-xhtml</parameter> (optional) </attribute>
<attribute>
<parameter>width</parameter> (optional) </attribute>
<attribute>
<parameter>height</parameter> (optional) </attribute>
<attribute>
<parameter>type</parameter> (optional) </attribute>
<attribute>
<parameter>redirect</parameter> (optional) </attribute>
<attribute>
<parameter>condition</parameter> (optional) </attribute>
<attribute>
<parameter>name-to-remove</parameter> (optional) </attribute>
<attribute>
<parameter>set-to-remove</parameter> (optional) </attribute>
<attribute>
<parameter>title</parameter> (optional) </attribute>
<attribute>
<parameter>debug-srcfile</parameter> (optional) </attribute>
<attribute>
<parameter>debug-srcline</parameter> (optional) </attribute>
<attribute>
<parameter>debug-log</parameter> (optional) </attribute>
/></funcdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id="vc_desc_template">
<title>Description</title>
<para>The container for any optional, repeatable or otherwise grouped controls or code. The type modifier is used to specify special kind of templates (i.e. repeatable content or tree node representation)</para>
</refsect1>
<refsect1 id="vc_attrs_template">
<title>Attributes</title>
<formalpara>
<title>name = <link linkend="vc_type_SqlName">SqlName</link>
</title>
<para>A page level unique name identifying a control.</para>
</formalpara>
<formalpara>
<title>annotation</title>
<para>A human readable comment.</para>
</formalpara>
<formalpara>
<title>initial-enable = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>Determines whether a control is initially visible. True by default. Could be data-bound to an SQL expression.</para>
</formalpara>
<formalpara>
<title>enabled = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>Determines whether a control is visible. True by default. Could be data-bound to an SQL expression.</para>
</formalpara>
<formalpara>
<title>instantiate = <link linkend="vc_type_CalculateableValue">CalculateableValue</link>
</title>
<para>Determines whether a control instantiate its children. It is true by default. It could be data-bound to an SQL expression. Unlike most of calcucateable attributes, the value of this attribute for a control is calcluated before calling 'on-init' event handler of the control; other values are calculated before calling 'before-data-bind' event handler.</para>
</formalpara>
<formalpara>
<title>control-udt = <link linkend="vc_type_SqlName">SqlName</link>
</title>
<para>At run time every control is represented as an instance of some user-defined type (UDT). VSPX compiles selects the UDT to use depending on name of the XML element that represents the control and maybe some of its attributes. In some specific cases the application developer may instruct VSPX compiler to use some other UDT, e.g. an application-specific UDT that is derived from the preset one. If specified, the value of 'control-udt' attribute should be equal to the name of the desired target UDT.</para>
</formalpara>
<formalpara>
<title>xsd-stub-xhtml</title>
<para>This attribute is for internal use only. It has no effect if added to the source VSPX file.</para>
</formalpara>
<formalpara>
<title>width</title>
<para>Visible width of the control when it is displayed in WYSIWYG tools when the source VSPX text is edited.
The value of this attribute will not be used when the resulting HTML is rendered.</para>
</formalpara>
<formalpara>
<title>height</title>
<para>Visible width of the control when it is displayed in WYSIWYG tools when the source VSPX text is edited.
The value of this attribute will not be used when the resulting HTML is rendered.</para>
</formalpara>
<formalpara>
<title>type</title>
<para>The behaviour of the template.</para>
<table>
<title>Allowed values of the 'type' attribute</title>
<tgroup cols="2">
<tbody>
<row>
<entry>simple</entry>
<entry>
<para>The template contains an arbitrary number of controls and HTML tags and groups them together to control their processing, e.g. to enable or disable them altogether depending on some condition.</para>
</entry>
</row>
<row>
<entry>repeat</entry>
<entry>
<para>A repeating row of v:data-set. The template of this type will be repeated for each row in the window of the data-set. It will be instantiated, data bound, rendered. If the template contains forms and submits, they get the post method called as one would expect.
On data binding, the parent of the template has its dg_current_row data member set to an array representing the selected row from left to right.
</para>
</entry>
</row>
<row>
<entry>row</entry>
<entry>
<para>A repeating row of v:data-grid. The template of this type will be repeated for each row in the window of the v:data-grid. It will be instantiated, data bound, rendered. If the template contains forms and submits, they get the post method called as one would expect.
On data binding, the parent of the template has its dg_current_row data member set to an array representing the selected row from left to right.
</para>
<para>
The controls under this template (such as text, label, button etc.) can access data in current row in order as columns are given by referencing te_rowset member of row template.
</para>
</entry>
</row>
<row>
<entry>frame</entry>
<entry>
<para>
A non-repeating static content of v:data-grid.
Content of this template represents view in page when rows are selected,
position of scroll buttons, rowset and form for adding a record.
</para>
</entry>
</row>
<row>
<entry>if-exists</entry>
<entry>
<para>
Template that is enabled only if the resultset is not empty in v:data-set.
</para>
</entry>
</row>
<row>
<entry>if-not-exists</entry>
<entry>
<para>Template that is enabled only if the resultset is empty in v:data-set.</para>
</entry>
</row>
<row>
<entry>add</entry>
<entry>
<para>Template that is enabled when user adds new record in the resultset in v:data-set (if the resultset is not read-only).
Similarly to templates of type 'edit', the 'add' template contains a vspx:form of type 'update' that is used to allow adding of rows in table as specified.
Usually this form is a vspx_form + vspx_text constrained to columns and table selected in SQL expression of the parent vspx:data-set control with value of key attributes set to null. Please remember to set the 'if-not-exists' attribute of the form to 'insert'.</para>
</entry>
</row>
<row>
<entry>browse</entry>
<entry>
<para>This type is meaningful only for templates right inside templates of type 'repeat'. When the template of type 'repeat' is used multiple times to display every row of a data-set, the template of type 'browse' expands only for those rows that are not currently editable.
</para>
</entry>
</row>
<row>
<entry>edit</entry>
<entry>
<para>Template that is enabled when user edits an existing record in the resultset in v:data-set (if the resultset isnot read-only and if the 'edit' attribute of v:data-set is set to 'true').
The template of this type usually contains a vspx:form of type 'update';
the 'table' attribute of the form is the name of the table from 'sql' attribute of the v:data-set where the 'edit' template is located; controls of the form are usually constrained to columns of the SQL expression of that 'sql' attribute.</para>
</entry>
</row>
<row>
<entry>if-login</entry>
<entry>
<para>Template that is enabled when user is logged in (e.g. for use in v:login. If the login is valid, the contents of this child will be instantiated. This can be for example a button with 'action' attribute set to 'logout', a welcome message or such. When using the vspx:login system, the user name is is obtained by connection_get ('vspx_user').</para>
</entry>
</row>
<row>
<entry>if-not-login</entry>
<entry>
<para>Template that is enabled when user is not yet logged in or is already logged out (e.g. for use in v:login.
The template specifies what to do if there are no credentials with the page.
If the 'redirect' attribute is given, then the entire page containing
this is not processed at all but instead the page specified in the url
is processed instead, with the context being that of the invocation of
this page. The redirect page can thus ask for the login and having
checked it return to this page, since it knows the url for this. In
this way it is possible to bookmark places of which the uri's may
expire, and accessing an expired place will just prompt for the login
before going to the page.
If the redirect is not specified, the content of the template is instantiated and shown. The content can be arbitrary, e.g. the vspx:login-form control can appear here, providing a standard login form that prompts for a user name and password and has a submit button.</para>
</entry>
</row>
<row>
<entry>tree-node</entry>
<entry>
<para>
Template for internal nodes of the tree in v:tree (i.e. for nodes with children).
</para>
</entry>
</row>
<row>
<entry>tree-leaf</entry>
<entry>
<para>Template for terminal nodes of the tree in v:tree (i.e. for nodes without children).</para>
</entry>
</row>
<row>
<entry>input</entry>
<entry>
<para>Template for input the SQL statement to execute it interactively in v:isql element.</para>
</entry>
</row>
<row>
<entry>result</entry>
<entry>
<para>Template to show if v:isql returns result without an error.</para>
</entry>
</row>
<row>
<entry>error</entry>
<entry>
<para>Template to be shown by v:isql if the user entered the SQL query and the execution of this query caused an error.</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</formalpara>
<formalpara>
<title>redirect</title>
<para>The URL to which the user agent is redirected if not authenticated, applicable only when type is 'if-no-login'.</para>
</formalpara>
<formalpara>
<title>condition = <link linkend="vc_type_SqlCode">SqlCode</link>
</title>
<para>This is a SQL expression to be tested for rendering the template</para>
</formalpara>
<formalpara>
<title>name-to-remove</title>
<para>This works together with set-to-remove, see next.</para>
</formalpara>
<formalpara>
<title>set-to-remove</title>
<para>This combined with name-to-remove gives posibility to remove a HTML elements from output.</para>
<table>
<title>Allowed values of the 'set-to-remove' attribute</title>
<tgroup cols="2">
<tbody>
<row>
<entry>none</entry>
<entry>
<para>The rendered output of the enclosing template will not be affected by the 'name-to-remove' attribute of the template.</para>
</entry>
</row>
<row>
<entry>top</entry>
<entry>
<para>The rendered output of the enclosing template should not contain the first opening tag whose name is equal to the value of 'name-to-remove' attribute of the template.</para>
</entry>
</row>
<row>
<entry>bottom</entry>
<entry>
<para>
The rendered output of the enclosing template should not contain the last closing tag whose name is equal to the value of 'name-to-remove' attribute of the template.
</para>
</entry>
</row>
<row>
<entry>both</entry>
<entry>
<para>
The rendered output of the enclosing template should not contain the both the first opening tag and the last closing tag whose name is equal to the value of 'name-to-remove' attribute of the template.
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</formalpara>
<formalpara>
<title>title</title>
<para>When used inside tab control, this is used to show as label of the selector</para>
</formalpara>
<formalpara>
<title>debug-srcfile</title>
<para>URI of the source document where the tag comes from.</para>
</formalpara>
<formalpara>
<title>debug-srcline</title>
<para>Line number in the source document where the tag comes from.</para>
</formalpara>
<formalpara>
<title>debug-log</title>
<para>This defines what sort of data are saved to the debugging log.
</para>
</formalpara>
</refsect1>
<refsect1 id="vc_udt_template">
<title>Declaration of type vspx_template</title>
<para>
</para>
<screen>
create type vspx_template under vspx_control
temporary self as ref
constructor method vspx_template (name varchar, parent vspx_control)
</screen>
</refsect1>
</refentry>
|