Re: Who is in Chat

  •  10-12-2006, 3:51 AM

    Re: Who is in Chat

    Thanks Adam, Added and working at emrupdate.com

    For the benefit of anyone who isn't sure, this is the completed "Skin-WhoIsOnline.ascx":
    <%@ Control Language="C#" %>
    <%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
    <%@ Register TagPrefix="CSD" Namespace="CommunityServer.Discussions.Controls" Assembly="CommunityServer.Discussions" %>
    <%@ Import Namespace="CommunityServer.Components" %>
    <%@ Import Namespace="CommunityServer.Discussions.Components" %>
    <%@ Import Namespace="CuteSoft.Chat" %>
    <script runat="server">

     

    private void Page_Load(object sender, System.EventArgs e)

    {

       if (! this.IsPostBack)

       {

          String sOnlineChater = "";

          int len=0;

          foreach(CuteChatLobby lobby in ChatApi.GetLobbyArray())

          {

             if(lobby.IsHidden)

                continue;

             foreach(CuteChatClient chater in ChatApi.GetLobbyClientArray(lobby.LobbyId))

             {

                if(chater.ActiveTime > DateTime.Now-TimeSpan.FromSeconds(30) )

                {

                   sOnlineChater += chater.DisplayName + " ";

                   len++;

                }

             }

          }

          lblOnlineCount.Text = len.ToString();

          if(len>0)

             lblOnlineChater.Text = " (" + sOnlineChater + ")";

       }

    }

    </script>

    <div class="CommonInlineMessageArea">
        <h4 class="CommonInlineMessageTitle">
            <a href="<%= Globals.GetSiteUrls().WhoIsOnline%>"><CS:ResourceLabel runat="server" ResourceName="WhoIsOnline_Current" id="Resourcelabel1"/></a>
        </h4>
        <div class="CommonInlineMessageContent">
            <CS:ResourceLabel runat="server" ResourceName="WhoIsOnline_Inline1" />
            <asp:Literal id="GuestUsers" Runat="server"/>
            <asp:Literal id="UsersOnlineCount" runat="server" />
            <asp:Repeater Id="UsersOnline" Runat="server">
                <HeaderTemplate>- </HeaderTemplate>
                <ItemTemplate><a title='<%# DataBinder.Eval(Container.DataItem, "Location") %>'
                        class='<%# ( (bool) DataBinder.Eval(Container.DataItem, "User.IsAdministrator") ) ? "" : "" %><%#  ( (bool) DataBinder.Eval(Container.DataItem, "User.IsModerator") && !(bool) DataBinder.Eval(Container.DataItem, "User.IsAdministrator") ) ? "" : "" %>'
                        href='<%# Globals.GetSiteUrls().UserProfile( (string) DataBinder.Eval(Container.DataItem, "Username")) %>'><%# DataBinder.Eval(Container.DataItem, "User.DisplayName")%></a></ItemTemplate><SeparatorTemplate>, </SeparatorTemplate>
            </asp:Repeater>
            <br /><br />
       There are <asp:Label ID="lblOnlineCount" Runat="server"></asp:Label> users chatting<asp:Label ID="lblOnlineChater" Runat="server"></asp:Label>.
        </div>
    </div>


View Complete Thread