Start page

Mykola Zharkikh (Kyiv)

Personal site

?

Setting attributes

"Set attribute" command is available in the standard Smereka editor in toolbar that is left of the inspector. Keyboard shortcut for it – Alt + A.

This command invokes the dialog window, where one can set the attribute name (note that it is case-sensitive), attribute value and domain – scope of the command.

Attribute value can be string, integer or real number, calendar date in the format YYYY-MM-DD HH:MM:SS.

Domain may be one of the following: the current node, crown (current node + all it child nodes), child nodes (only subordinate nodes without current), sibling nodes and sibling nodes with the crowns.

The result of the command is setting the attribute value for all nodes of domain.

For reasons of security, this command can not set id attribute. Note also that the attribute symbname must have a unique value for each group of sibling nodes, so setting this attribute by using this command will lead assigning value + node ID to symbolic name.

The "current node" domain seems to be redundant, because one can set the attribute directly in the informator. If the informator provide the corresponding field – there is really no difference. But one have remember that the standard editor for the sake of simplification does not show all available attributes; specialized editors, designed for a limited range of tasks, further reduces the set of available attributes. This command allow to set any attribute provided it's name is known.

One should take into account that when setting the value of language-dependent attribute this command used language, which is currently set in the editor. So to set the attribute for all language versions, one must repeat this command in the context of all languages.

Consider a typical example this command application. We are preparing to publish a long article or book, which consists of a root node and 20 subordinate nodes at different levels. At the editorial stage of preparation, all these nodes have a higher level of access than public, so only the editor, but not visitors can see them.

When the editorial process ends, it's time to give public access level for all these nodes. If do this manually, one should download each node in the editor, open the appropriate group of fields, set the "Access level" to the value 5 and save. And so 21 times in what easily miss something.

With this command one should go to the root node of publication, specify the attribute name accesslevel, attribute value 5 and "Crown" as domain. Then Smereka do everything else by itself.