Description of lists

From ISPWiki
Jump to: navigation, search

Introduction

The metadata element for lists can have the following additional attributes:

key
a key field. Its value will be sent to the form in the elid parameters while editing.
keyname
specifies a field which value is used for displaying a list of selected elements when performing group operation.
autoupdate
specifies period in seconds to automatically update the page.
selficon
this list has its own logo. Its value is a picture name.
  <metadata name="product" type="list" key="mpname" keyname="name" mgr="core">
    <toolbar view="buttontext">
      <toolbtn func="product.params" type="edit" default="yes" img="t-edit" name="params">
        <hide name="isinstalled" value="off"/>
      </toolbtn>
      <toolbtn func="product.update" type="edit" img="t-retry" name="update">
        <hide name="isinstalled" value="off"/>
      </toolbtn>
      <toolbtn func="product.install" type="edit" img="t-install" name="install">
        <hide name="isinstalled" value="on"/>
      </toolbtn>
      <toolbtn func="product.delete" type="group" img="t-delete" name="delete">
        <hide name="isinstalled" value="off"/>
        <hide name="name" value="COREmanager"/>
      </toolbtn>
      <toolsep/>
      <toolbtn func="product.go" type="edit" img="t-goisp" name="go">
        <hide name="isinstalled" value="off"/>
        <hide name="name" value="COREmanager"/>
      </toolbtn>
      <toolsep/>
      <toolbtn func="product.config" type="new" img="t-attr" name="config"/>
    </toolbar>
    <coldata>
      <col name="name" type="data" sort="alpha" sorted="yes"/>
      <col name="version" type="data"/>
      <col name="avail_version" type="data"/>
      <col name="state" sort="prop">
        <prop name="installed" defimg="p-off" onimg="p-on"/>
        <prop name="installing" onimg="p-install" animated="yes"/>
        <prop name="updating" onimg="p-install" animated="yes"/>
        <prop name="deleting" onimg="p-install" animated="yes"/>
      </col>
      <col name="descr" type="msg"/>
    </coldata>
  </metadata>

Toolbar (the toolbar element)

A toolbar can contain buttons and separators.

view
specifies interface of the toolbar. This attribute is set automatically and its value depends on current user settings. Possible values: button (display only buttons), buttontext (display captions to buttons).
the toolbtn element
см. Toolbar button
the toolsep element
см. Toolbar separator

Toolbar button (the toolbtn element)

name
button name, which is used for identifying a button. It is also used for languages.
func
name of the function to be called when clicking the button.
img
name of the picture that will be shown on the button. Should be specified without extensions.
default
"yes" indicates a default action (double-click on a table raw).
type
type of action, can have the following values:
  • new: will show a new object creation form.
  • back: back to previous list.
  • edit: show the selected object edit form.
  • editlist: call a list-function which parent element (plid) is the selected element from the list.
  • group: group operation over selected elements.
  • groupform: edit selected elements.
  • groupformnosel: similar to groupform except for it allows to call a function even if no elements are selected.
  • list: call a list-function.
  • refresh: call a function for updating the current list.
  • window: call a function in a new browser tab.
  • url: Follow the URL specified in the func attribute in a new browser tab.
the hide element
the show element

The hide element: disable button depending on selected string.

name
column name
value
the value that makes the button unavailable.

See example

The show element

Activate button depending on the selected string.

name
column name
value
the value that makes the button available.

Example

Toolbar separator description (the toolsep element)

Creates a large separator between buttons. If several toolsep come one after another, all of them but one will be removed. This situation may occur if a group of buttons was deleted from the toolbar.

Table column description (the coldata element)

The coldata node must contain one or several col nodes describing table columns.

the col element
describes a table column.
the setcolor element
specifies column color. See setcolor description for more details.

Column description (the col element)

name
Column name. Must be unique within one metadata. It is used for languages.
type
data type in a column. Possible values: data (data from a control panel; used by default), indicator (indicator; limit and actual usage sent by the control panel), msg (display messages corresponding to the value from the control panel).
sort
specifies how to to sort out data in columns. Possible values: alpha (sort by alphabetical order; by default), digit (in increasing order), file (sort by alphabetical order, first show directories, than files; used only with prop/xprop, as in file manager), indicator (sort out by the "actual usage" indicator; only for columns with indicators), ip (sort out IP addresses), prop (sort out by properties, if the same properties are used, sort by column value in alphabetic order).
sorted
if sorted="yes", the table is specified by this column by default. sorted="desc" sort our in descending order.
stat
show total number of raws with such a field at the button of the table.
wrap
if specified, ... will be ignored. Data in the column will be shown in several raws.
align
data alignment. Its values can be left, right, center.
width
column default width.
if
see Introduction.
level
see Introduction.
noescaping
if specified, html escaping will be disabled.
convert
specifies encoding algorithm for the column. All values in that column will be converted using the specified algorithm. Currently only punycode is supported allowing to convert from punycode into UTF-8 encoded symbols.
edit
enables to edit element on the list. Value of the attribute specifies a function name (form) to be called for saving the value. Make sure the column value matches the field name (field) on the form. The column name (scolname) and the list name (stablename) will be also sent to the form. If the field value influences the raw identifier, the function must return a new identifier [elid] and name [elname] (if its value does not coincide with the identifier)
setcolor
specifies how table cells should be colored. See description of the setcolor element.

Property description (prop/xprop)

A column may have up to 64 properties (prop and xprop elements). Properties are sorted out according to how they are added into metadata.

the prop element
is displayed if the value with the name specified in the @name attribute is present in the string.
the xprop element
is displayed if the value specified in the @name attribute matches the value specified in the @value attribute. If the @value attribute is not specified or its value is empty, the property will be displayed if the value of this element does not correspond to any xprop with the same @name.

The prop and xprop elements may have the following attributes:

name
see description above.
value
only for xprop. see description above
img
specifies an image to be displayed.
animated
img image — animated gif-file
func
specifies a function to be called when clicking the image. The following values are sent to that function as parameters: elid - selected raw identifier, plid - identifier in the base list, value - property value.
type
specifies a type of the @func function. See toolbar description for possible values
stat
display total number of raws with that property at the bottom of the table.

Messages may contain description of a property:

hint_p_<name>_<value>
description for xprop with a specified name and value
hint_p_<name>
description for prop/xprop. The __value__ macros will be changed into a value.

Color scheme (the setcolor element)

The setcolor element is applied to one cell only (text color), if described within the col element, or to the whole raw (background color), if described within the coldata element. You can describe any number of conditions for raws and cells color.

name
specifies an element name (it may be col, prop, xprop or a column name, which is not described in the XML), which value will be compared with the specified one in the value attribute. You may not specify this attribute when adding rules for cell colors. In that case the value will be taken from the cell for which the rule is specified.
value
specifies the value that will be compared a field value specified by the @name attribute. If it is not specified or empty, the field in the line will be checked.
color
specifies color that will be applied if the specified condition is met.

Table raws and cells can be colored manually when generating data (the elem elements). Add the color attribute into a corresponding elem element for coloring a raw or into any element with cell data for coloring a corresponding cell. When sending data to xslt the handler, all conditions specified by the setcolor element will be defined, and corresponding attributes will be set in data elements of the list.

The following color are currently supported: red, green, blue, yellow, cyan

Diagram description (the diagram element)

Using the diagram element data can be displayed in the table.

the type attribute
Diagram type. Possible values: line, histogram, pie.
the label attribute
the column from which value descriptions will be taken.
the data attribute
the column from which data for a pie chart will be taken will (only for type="pie").
the line element
one or several elements describe data to be displayed on a chart. The @data attribute specifies a name for the column from which volumes will be taken.