Kentico CMS 7.0 Developer's Guide

Reference

Reference

Previous topic Next topic Mail us feedback on this topic!  

Reference

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

This topic lists variables and commands that you can use in chat transformations. Each section of this topic is dedicated to a single type of object, i.e., messages, rooms, users, notifications, support chat objects and errors.

 

To learn how to use these values in transformations, refer to the Writing transformations for chat topic. You can also take inspiration in the default transformations within the Chat - Transformations document type.

 

Messages list

 

The following table lists data variables that are available when displaying messages. You can either display the variables' values or evaluate them in conditional statements.

 

Variable name

Data type

Description

AuthorID

int

Contains the database ID of the chat user who sent the message. If the message is a system message, the value is null.

IsOneOnOne

bool

Returns true if the message is part of a one-on-one chat session.

IsRejected

bool

Returns true if the message has been rejected.

IsSupport

bool

Indicates if the message is part of a support chat session.

LastModified

date/time

Contains the time when the message was modified.

MessageID

int

Returns the database ID of the message.

MessageText

string

Contains the text of the message.

Modified

bool

Indicates if the message has been modified.

Nickname

string

Contains the nickname of the sender. If the message is a system message, the value is null.

PostedTime

date/time

Contains the time when the message was sent.

Recipient

string

Returns the nickname of the message's recipient. If the message is addressed to all users in a particular room, i.e., the recipient is not specified, the value is null.

RecipientID

int

Contains the database ID of the recipient, if specified.

SystemMessageType

int

Contains the type of the message represented by an integer number as follows:

0 - classic message

1 - whisper

2 - leave room

3 - enter room

4 - change nickname

5 - kick

6 - user invited

7 - support greeting

8 - permanently leave room

9 - permanent kick

10 - announcement

11 - declined chat request

 

The following table lists commands that you can use, for example, in onclick events.

 

Command name

Description

SelectRecipient

Selects the sender of the message in the Recipient drop-down list as the recipient of the next message.

SelectPrevRecipient

If the message is a whisper message, this command selects the recipient of the message as the recipient of the next message.

RejectMessage

Rejects the message.

 

Rooms list

 

The following table lists data variables that are available when displaying the list of rooms. You can either display the variables' values or evaluate them in conditional statements.

 

Variable name

Data type

Description

AllowAnonymous

bool

Indicates whether the room allows anonymous users.

CanManage

bool

Indicates whether the current chat user can manage the room.

ChatRoomID

int

Contains the database ID of the room.

Description

string

Contains the room's description.

DisplayName

string

Contains the name of the room.

HasPassword

bool

Indicates whether users are required to enter a password to join the room.

IsCurrentRoom

bool

Indicates whether the current chat user is present in the room. The value takes into account the group that the web part displaying the list is in.

IsPrivate

bool

Indicates whether the room is private.

 

The following table lists commands that you can use, for example, in onclick events.

 

Command name

Description

Abandon

Removes the current user from the room. Revokes access if the room is private.

Delete

Disables the room and schedules it for deletion.

Delete

Opens the room editing dialog box.

 

 

InfoBox_Exclamation

 

Important!

 

When rendering rooms, you should always wrap them in an anchor tag with "JoinRoom" as the class attribute value. This will allow users to join the room upon clicking.

 

Example:

 

<a class="JoinRoom">${DisplayName}</a>

 

 

Room name

 

When you want to display the name of the current room in the Chat room name web part, you need to create a separate transformation. You can display the room name in the transformation using the RoomName variable.

 

Users list

 

The following table lists data variables that are available when displaying the list of users in a chat room. You can either display the variables' values or evaluate them in conditional statements.

 

Variable name

Data type

Description

ChatUserID

int

Contains the database ID of the chat user.

IsAdmin

bool

Indicates whether the user can manage the room.

IsAnonymous

bool

Indicates whether the user is anonymous.

IsChatAdmin

bool

Indicates whether the user has the Manage rooms permission.

IsCreator

bool

Indicates whether the user is the room's creator.

IsCurrentUser

bool

Indicates whether the user is the currently logged in user.

IsOnline

bool

Indicates whether the user is currently on-line.

Nickname

string

Contains the user's nickname.

 

The following table lists commands that you can use, for example, in onclick events.

 

Command name

Description

AddAdmin

Gives the user administrator rights for the room.

DeleteAdmin

Takes administrator rights away from the user.

KickUser

Kicks the user from the room.

KickUserPerm

Permanently kicks the user from the room. Removes the Join permission from the user.

OneOnOneChat

Initiates a one-on-one chat session with the user.

 

The following table lists data variables that are available when displaying the list of users that are on-line in chat. You can either display the variables' values or evaluate them in conditional statements.

 

Variable name

Data type

Description

ChatUserID

int

Contains the database ID of the chat user.

IsAnonymous

bool

Indicates whether the user is anonymous.

Nickname

string

Contains the user's nickname.

 

 

InfoBox_Exclamation

 

Important!

 

When listing users who are on-line in chat, you need to include the ${OnClick} command in an OnClick event. The command ensures that other users will be able to initiate one-on-one chat with the user.

 

The transformation where you use this command will also be used when inviting users to a room. In this case, the command will make sure that the user gets selected.

 

 

Notifications

 

The following table lists data variables that are available when displaying notifications. You can either display the variables' values or evaluate them in conditional statements.

 

Variable name

Data type

Description

IsOneOnOne

bool

Indicates whether the notification is a one-on-one chat invitation.

KickTime

int

Contains the information about how long a user will be kicked from a room. This variable is only available when the NotificationType variable has a value of 4.

NotificationDateTime

date/time

Contains the time when the notification was created.

NotificationID

int

Contains the database ID of the notification.

NotificationType

int

Contains the integer representation of the notification type. The possible values are the following:

0 - invitation

1 - invitation declined

2 - invitation accepted

3 - nickname automatically changed

4 - kick

5 - permanent kick

6 - administrator added

7 - administrator deleted

ReadDateTime

date/time

Contains the time when the notification was read. If the message has not been read, the value is null.

RoomID

int

Contains the database ID of the room of concern. If the notification isn't related to room activity, the value is null.

RoomName

string

Contains the name of the room of concern. If the notification isn't related to room activity, the value is null.

SenderNickname

string

Contains the nickname of the user who performed the action that caused the notification to appear, e.g., the user who invited another user to a room.

 

The following table lists commands that you can use, for example, in onclick events.

 

Command name

Description

AcceptEvent

Accepts an invitation. Applicable only when the NotificationType variable has a value of 0.

DeclineEvent

Declines an invitation. Applicable only when the NotificationType variable has a value of 0.

CloseEvent

Closes (deletes) a notification. Applicable for all notification types except for invitations (NotificationType is not 0).

 

Support request

 

When writing a transformation for the Chat support request web part, you can use the LiveSupport variable, which indicates whether a support person is on-line.

 

Initiated chat

 

Transformations for initiated chat must have the following format:

 

{{if MessagesTemplate}}

    <code used for messages>

{{else}}

  <code used for the whole web part>

{{/if}}

 

In the code used for messages, you can use the Text variable to insert the text of the message.

 

In the code for the web part, you can use the following variables and commands:

 

Accept - command that accepts the initiated chat and opens the support chat window.

Reject - command that rejects the initiated chat.

Initiator name - string variable containing the name of the initiator.

Messages - string that contains all messages.

 

Errors

 

When writing a transformation for errors, you can use the Message string variable, which contains the error message. It is recommended to insert it in the following form so as to resolve potential HTML code.

 

{{html Message}}

 

When writing a transformation for the Delete all button in the list of errors, you can use the DeleteAll command, which deletes the errors.