Messaging
The Messaging server control lets a site user send and receive messages. You can limit message recipients to a user’s colleagues or expand it to all Ektron users. The Messages control can appear on a site or also in the Workarea. Typical messaging functions apply, such as compose ( in the Workarea), reply ( in the Workarea), forward ( in the Workarea), print ( in the Workarea), delete ( in a sample site, in the Workarea).
Populating the To: field of a message
You can populate a message's To: field with user names by setting the RecipientParamName
property to a QueryString parameter. This feature lets you create a link on a page, such as Send a Message to this user or Send a message to all users in this group. For example, you create a Web page link to a template containing the Messaging server control, pass a user’s ID in the QueryString as UID, and populate the RecipientParamName
property with UID. As a result, the server control reads the user’s ID and completes the To: field with the user’s name.
Here is how the link might look: messaging.aspx?g=pmessage&uid=1
You can pass multiple user IDs. For example: messaging.aspx?g=pmessage&uid=1&uid=20&uid=12&uid=18
IMPORTANT: You must include the g=pmessage
parameter in the QueryString to open the Messaging server control to its editor. Otherwise, the server control opens to the Inbox.
The VB example below creates a dynamic hyperlink that populates a message's To: field with a logged in user’s colleagues. For this example to work, add a Literal control to a Web form and name it Lit1. Notes are included as comment text.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim frnds As New Ektron.Cms.API.Community.Friends() Dim apicontent As New Ektron.Cms.ContentAPI Dim dirUsrData() As Ektron.Cms.DirectoryUserData If (apicontent.UserId > 0) Then dirUsrData = frnds.GetFriends(apicontent.UserId) If ((Not IsNothing(dirUsrData)) AndAlso (dirUsrData.Length > 0)) Then Dim idx As Integer Dim friendsList As String = String.Empty For idx = 0 To dirUsrData.Length - 1 'friendsList += "&uid=" + dirUsrData(idx).Id.ToString() friendsList = friendsList + "&uid=" + dirUsrData(idx).Id.ToString() Next Lit1.Text = "<a href=""MsgSample.aspx?g=pmessage" + friendsList + """>Send a message to my friends</a>" ' 'Replace MsgSample.aspx with the Web form that contains 'the messaging server control. 'Set the RecipientParamName property to "uid" for this example. ' Else Lit1.Text = "The logged in user currently has no friends" End If Else Lit1.Text = "You must be logged in to run this demo" End If apicontent = Nothing frnds = Nothing End Sub
Inserting the Messaging server control onto a page
Prerequisite
You must have installed the server controls. See Installing server controls into Visual Studio Toolbox.
- In Visual Studio, choose View > Toolbox.
- Click the Ektron server control tab to display the server controls.
- Drag the Messaging server control and drop it into the desired location on the page.
NOTE: You also can place the cursor on the page where you want the server control, then double click the server control that you want.
<CMS:Messaging ID="Messaging1" runat="server" />
- Click on
Messaging
in the code to display and modify the control’s properties using the Properties window of Visual Studio. The page is updated as you modify the property values.
Messaging properties
The following are Ektron-specific server controla server control uses API language to interact with the CMS and Framework UI to display the output. A server control can be dragged and dropped onto a Web form and then modified. properties. For information about native .NET properties such as font, height, width and border style, use Visual Studio® help.
- DisplayXslt (String)
If desired, enter a relative or absolute path to an Xslt that determines the display of the page.
WARNING! Files stored in the
siteroot\Workarea
folder are overwritten (or deleted) when you upgrade Ektron. To avoid problems, copy the default file to a folder outside thesiteroot\workarea
folder then edit it. If there is no default file, create the file outside thesiteroot\workarea
folder. Next, in this property, enter the path to that file relative to the site root folder. - DoInitFill (Boolean)
By default, Fill occurs during the Page_Init event. Set to false if you want to postpone the fill-action until later. In this case, Fill is automatically called during the Page Render event. You might do this if you need to set or change a property on the control in code-behind and have it render with your changes shown.
- EnablePreSearch (Boolean)
When set to True, all users are pre-loaded and displayed in the search results when browsing for users (an empty string search). If the
FriendsOnly
property is set to True, only colleagues are pre-loaded and displayed. - FriendsOnly (Boolean)
When set to True, users can only send messages to their colleagues.
- True (default). Send messages to colleagues only
- False. Send messages to all Ektron users
- GroupParamName (String)
Enter the QueryString parameter used to pass the ID of a community group. The default is gid. Use this property to email all members of a group.
- Hide (Boolean)
Hides or displays the output of the control in design time and run time.
- True. Hide the control output.
- False. Display the control output.
- JavascriptEditorHeight (Integer)
Set the height in pixels for the eWebEdit400 editor. The default is 300.
- JavascriptEditorWidth (Integer)
Set the width in pixels for the eWebEdit400 editor. The default is 360.
- Language (Integer)
Set a language for viewing content; shows results in design-time (in Visual Studio) and at run-time (in a browser).
- ProfileParamName (String)
The QueryString parameter used to pass the ID of a user to a profile page or location template when a user name is clicked in the Browse User screen. The default is ID. The parameter defined in this property is appended to the QueryString of the path defined in the
ProfileUrl
property. The default is ID.IMPORTANT: This parameter must match the parameter set in the UserProfile server control’s
DynamicParameter
property on the page defined in theProfileUrl
property. - ProfileUrl (String)
The URL of the profile page template. This page opens in a new window when a user clicks a display name on the Browse Users screen. This provides additional profile information about the potential message recipient.
- RecipientParamName (String)
Enter the QueryString parameter used to pass a user ID. For example, if the QueryString is
?uid=1
, enteruid
in this property. To pass several users, enter a comma -separated list of user IDs. For example:?uid=1,20,12,18
. This property is typically used when you want to populate a message's To: field. See also: Populating the To: field of a message - Stylesheet (String)
Specify the path to a style sheet for use with this server control. Leave blank to use the default style sheet. To use a custom style sheet, place it in a folder outside the
siteroot\workarea
folder then edit it. Next, in this property, enter the path to the custom style sheet relative to the site root folder.WARNING! Files stored in the
siteroot\Workarea
folder are overwritten (or deleted) when you upgrade Ektron. To avoid problems, copy the default file to a folder outside thesiteroot\workarea
folder then edit it. If there is no default file, create the file outside thesiteroot\workarea
folder. Next, in this property, enter the path to that file relative to the site root folder.NOTE: If you enter a valid EkMLEktron Markup Language file at the
MarkupLanguage
property, theStylesheet
property is ignored. - SuppressWrapperTags (Boolean)
Suppresses the output of the span/div tags around the control.
- True. Suppress wrap tags.
- False (default). Allow wrap tags.
- UserSearchDisplayXslt (String)
The XSLT used to display the user search control inside the Messaging server control. The default is
MsgUserSelect.xsl
.WARNING! Files stored in the
siteroot\Workarea
folder are overwritten (or deleted) when you upgrade Ektron. To avoid problems, copy the default file to a folder outside thesiteroot\workarea
folder then edit it. If there is no default file, create the file outside thesiteroot\workarea
folder. Next, in this property, enter the path to that file relative to the site root folder. - WrapTag (String)
Lets a developer specify a server control’s tag.
- Span (default). Designate an inline portion of an HTML document as a span element.
- Div. Apply attributes to a block of code.
- Custom. Lets you use a custom tag.