Re: AspNetForums set up & customization

  •  12-15-2004, 9:56 PM

    Re: AspNetForums set up & customization

    Hi Adam,

     

    Thanks for the Tip.

     

    Is there any documentation on CuteChat’s public API’s?

     

    My requirement is to list all Moderators using ab asp:repeater, show an icon next to each one displaying if they are currently online, display the LiveHelp icon next to that so that if they are online then Forum users can chat with them.

     

    Is there a method I can use to find if a particular Moderator is online, not just if any Moderator is on line.

     

    i.e if(CuteChat.ChatFactory.HasThisSupportOperatorOnline(“UserName” or “UserId”))

     

    Can I set up a Room for each moderator?

    As it appears from testing that if another online moderator starts LiveHelp support they can not use the same Room with the same Id.

     

    i.e. /cutechat/SupportServer.Aspx?RoomID=UserId

     

    Example.

     

    <asp:repeater id="ModeratorsRepeater" runat="server">

    <itemtemplate>

      <table border="0" cellpadding="1" cellspacing="1" width="100%" class="chatOnline">

      <tr>

        <td width="70%"><%# DataBinder.Eval(Container.DataItem, "Username") %></td>

        <td width="15%"><asp:image id="online" runat="server" alternatetext="Off line"

              imageurl="~/Themes/default/images/user_IsOffline.gif"/>

        </td>

        <td width="15%"><asp:imagebutton enabled="True" causesvalidation="False" id="LiveHelp"

             imageurl="~/cutechat/images/colourpick.gif" runat="server" alternatetext="Not available"/>

        </td>

      </tr>

     </table>

    </itemtemplate>

    </asp:repeater>

     

    /// <summary>

    /// Loop through list of Moderators and set an icon to show if they are onLine,

    /// and update LiveHelp button Alt Text to say they are now available

    /// </summary>

    /// <param name="sender"></param>

    /// <param name="e"></param>

    private void ModeratorsRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e)

    {

    //Set each online image to show if Moderator is active

                if((DateTime)DataBinder.Eval(e.Item.DataItem,"LastActivity") > DateTime.Now.AddMinutes(-10))

                {

                            Image online = (Image) e.Item.FindControl("onLine");

                            online.ImageUrl="~/Themes/default/images/user_IsOnline.gif";

                            online.AlternateText="Now available";

                }

     

                //Get each Moderators details. (may help for the next bit)

                int id = (int)DataBinder.Eval(e.Item.DataItem,"UserId");

                string userName = DataBinder.Eval(e.Item.DataItem,"Username");

     

                //Get LiveHelp imageButton

                ImageButton liveHelp = (ImageButton) e.Item.FindControl("LiveHelp");

     

                //Need to find if this user "userName" is Support User & if he is online

                //Then set LiveHelp Alt text & online livehelp.gif image

                //At the moment every time one LiveHelp support user logs on, all LiveHelp

                //image buttons become available

                if(CuteChat.ChatFactory.HasSupportOperatorOnline(1))

                {

                            liveHelp.ImageUrl = "~/cutechat/images/livehelp.gif";

                            liveHelp.AlternateText="Now available";

                }

     

                //If current logged on user is Moderator (LiveHelp User)

                //then set link to SupportServer.aspx

                if(ChatUtility.CurrentUserIsRoomAdmin(1))

                {

                            liveHelp.Attributes.Add("onClick","openWindow('"/cutechat/SupportServer.Aspx?RoomID=1',750,500)");

                }

                else

                {

                            liveHelp.Attributes.Add("onClick","openWindow('"/cutechat/ChatSupport.Aspx?RoomID=1',750,500)");

                }

    }

View Complete Thread