ObjectGears Help

Forum   ObjectGears (Version:

Bracket command

Bracket commands can be used for a simple inclusion of commands into a text. These commands are replaced by means of script with an actual value at processing (e.g. at displaying). Závorkové příkazy slouží k jednoduchému zadání příkazů do textu. Tyto příkazy jsou při zpracování (např. zobrazení) pomocí skriptu nahrazeny aktuální hodnotou. The commands are used e.g. in the Knowledge Base for inserting an info panel. There is only text of an informatory message in the text and it is replaced by html tag DIV with a style applied at display - see the picture hereinafter.

Command format

Bracket command format:


Parameters par2 and par3 are not mandatory and do not need to be input.

Text command format:

The format is a text, in which character {0} to {4} are parameters according to the following table. The text that is created at replacement is the result of the bracket command.


Value in the format Used value
{0} prefix from the bracket command
{1} par1 from the bracket command
{2} par2 from the bracket command
{3} par3
{4} par4

Script functions for the command execution:

text = OG.TextUtils.ReplaceBracketCommand( text, prefix, format, par3, par4);


Parameter Description
text Text containing texts with bracket commands.
prefix Prefix of the bracket command that you want to process.
format Format for transformation of parameters into the resulting bracket command text.
par3 Parameter 3.
par4 Parameter 4.

You can have more bracket commands in the input text, that you distinguish by means of the prefix. You can process each prefix in another way - see hereinafter in the example prefix info, error, warning.


Text command:

{{info,TIP: Nová verze systému ObjectGears obsahuje více webpartů.}}
{{error,Na serveru XY je málo místa na disku.}}
{{warning,Uživatel nedokončil kontroly.}}

Resulting display:

Script for the processing of of the text command:

Text for display is stored in the variable text. Format describing, how the bracket command shall be displayed is stored in the variable format.

Following example is used for the panel display in model Knowledge Base.

var text = '...text with command...';

var format2 = '<div class="info">{1}</div>';
text = OG.TextUtils.ReplaceBracketCommand( text, 'info', format2, null, null);

format2 = '<div class="error">{1}</div>';
text = OG.TextUtils.ReplaceBracketCommand( text, 'error', format2, null, null);

format2 = '<div class="warning">{1}</div>';
text = OG.TextUtils.ReplaceBracketCommand( text, 'warning', format2, null, null);

Ignoring command character

In case you want to write a command and you do not want it to be executed, insert a backslash "\" before the first part of the command. This will cause that chracters that will follow will not be interpreted as a command but as a text to display.

Use this function e.g. in the Knowledge Base, in case you want to show the bracket command to the user.

{{\warning,User did not finish check-in.}}

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information