Kentico CMS 7.0 Developer's Guide

Example setup

Example setup

Previous topic Next topic Mail us feedback on this topic!  

Example setup

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

The Chat module with its web parts allows you to set up chat functionality on your site in many different configurations, or modes. The most basic use cases include single page mode and redirection mode, which are described in this topic.

 

Single page mode

 

Web parts belonging to the Chat module can be placed on a page one by one, thus compiling the functionality of the Chat web part from multiple components, allowing for customization of appearance and complexity. For example, you can leave out certain components in order to limit the set of features users of the chat can utilize. The following text explains how to set up multiple-room chat within a single page.

 

 

InfoBox_Tip

 

Tip

 

Chat web parts do not need any configuration in order to function properly. You can achieve standard behavior by leaving the web parts' properties at their default values. The default values are specified in the module's settings. On the other hand, the web parts and settings allow for a high level of customization.

 

 

Start by creating a new blank page. Then place the following web parts on the page. As mentioned previously, you can leave all their properties at their default values.

 

Chat login - this web part will serve as the starting point for users who wish to enter the chat, as well as an exit point for logged-in users.

Chat rooms - this component will display the list of rooms that the currently logged-in user can join.

Chat send message - this web part will display a text-box to allow sending messages.

Chat messages - this web part will display the most recent messages in a room.

Chat leave room - this web part will display a button that will allow users to leave the room they are in.

Chat notifications - this web part will display system notifications, such as room invitations.

 

Redirection mode

 

Many web parts that belong to the Chat module have the Redirect URL property. This attribute defines the URL of the page where the chat user should be redirected when performing the action the web part is intended for. For example, in the Chat room list web part, you would set the Redirect URL to the page that contains the Chat room messages web part.

 

Let's presume that you want to set up chat which will comprise the following pages:

 

Logon page

Page with list of chat rooms

Chat room page with messages

 

The following is a step-by-step tutorial how to set up chat on the pages. The procedure is presented on the sample Community site.

 

Please note that unless instructed otherwise, you can leave all the web parts' properties at their defaults.

 

Preparation

 

1. Create a new blank page called Chat. This will be the starting page, which the users will use to enter the chat.

 

2. Under the Chat page, create two blank pages called Room list, and Room.

 

3. On the Room list page, select the Properties -> Template tab, then click Edit template properties and select Inherit all in the Inherit content field. Then save the template.

 

4. Repeat the previous step on the Room page.

 

Basic setup

 

1. On the Chat page, add the Chat login web part. Set its properties as follows:

 

Redirect URL after entering chat: ~/Chat/Room-list.aspx

Redirect URL after logout: ~/Chat.aspx

 

This will ensure that users will be redirected to the correct page when logging in and out.

 

2. Place the Chat notifications web part on the Chat page.

 

This will allow users to see notifications about invitations to rooms and private conversations, as well as other system messages addressed specifically to the current user.

 

3. Place the Page placeholder web part on the Chat page.

 

The web part, along with the template settings defined previously, will cause the Chat login web part to appear on all subpages, allowing users to log out at any time.

 

4. On the Room list page, add the Chat rooms web part. Set the following property:

 

Redirect URL after join: ~/Chat/Room.aspx

 

When a user clicks a room in the list, the web part tries to join the user to the room. If that action is successful, the system redirects the user to the specified URL.

 

5. Place the Chat send message web part on the Room page.

 

This will allow sending messages to the room and its members.

 

6. Place the Chat room messages web part on the Room page.

 

This web part will display messages from other users in the room, as well as system messages and announcements.

 

7. Place the Chat leave room web part on the Room page. Set the following property:

 

Redirect URL after leaving: ~/Chat/Room-list.aspx

 

This will provide user a way to exit the room and return to the page with the list of rooms.

 

Extended setup

 

After completing the preceding procedure, you will have implemented a functioning multi-page chat with all the basic features. However, this configuration can be extended with additional features. The process is described in the following step-by-step tutorial.

 

1. Place the Chat on-line users web part on the Room list page.

 

This will enable users to see the list of users on-line in the chat regardless of the room they are in, if any. They will also be able to start a private conversation with any of the on-line users.

 

2. Add the Chat room name web part on the Room page.

 

This web part will display the name of the room the user is in.

 

3. Place the Chat room users web part on the Room page.

 

This will allow users in a room to see who else is on-line in the particular chat room and initiate a one-to-one chat session with them.