protected void Page_Load(object sender, EventArgs e)
    {
        // Register chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert script references
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatLeaveRoom_files/ChatLeaveRoom.js");

        string redirectURL = RedirectURL.Length > 0 ? RedirectURL : ChatSettingsProvider.RedirectURLLeaveSetting;

        // Prepare and run startup script
        string startupScript = String.Format("InitChatLeaveRoom({{groupID:{0}, clientID:'{1}', btnChatLeaveRoom:{2},pnlContent:{3}, redirectURL:{4}, envelopeID: '#envelope_{1}' }});",
                                             ScriptHelper.GetString(GroupID),
                                             ClientID,
                                             ScriptHelper.GetString("#" + btnChatLeaveRoom.ClientID),
                                             ScriptHelper.GetString('#' + pnlChatLeaveRoom.ClientID),
                                             redirectURL.Length > 0 ? ScriptHelper.GetString(ChatHelper.GetDocumentAbsoluteUrl(redirectURL)) : "\"\""
                                             );

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatLeaveRoom_" + ClientID, startupScript, true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsVisible)
        {
            pnlOnlineUsersWP.Visible = false;
            return;
        }

        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/ListPaging.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatOnlineUsers_files/ChatOnlineUsers.js");


        if (EnableFiltering)
        {
            pnlChatOnlineUsersFiltering.Visible = true;
        }
        if (InviteMode)
        {
            pnlChatOnlineUsersInvite.Visible = true;
        }

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "OnlineUsers_" + ClientID, BuildStartupScript(), true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert script references
        ChatScriptHelper.RegisterChatManager(Page);
        ChatScriptHelper.RegisterChatNotificationManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatNotification_files/ChatNotification.js");

        btnRemoveAllNotifications.OnClientClick = "ChatManager.RemoveAllNotifications(); return false;";
        btnShow.Text  = ResHelper.GetString("chat.notification.bubble.show");
        btnClose.Text = ResHelper.GetString("chat.notification.bubble.close");

        // Prepare and run startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatNotification_" + ClientID, BuildStartupScript(), true);

        imgChatRoomsPrompt.ImageUrl = GetImageUrl("CMSModules/CMS_Chat/message_information24.png");
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryUI(Page);
        ScriptHelper.RegisterScriptFile(Page, "jquery/jquery-a-tools.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/BBCodeParser.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatMessageSend_files/ChatMessageSend.js");

        imgInformationDialog.ImageUrl = GetImageUrl("General/Labels/Information.png");

        RoomID = ChatUIHelper.GetRoomIdFromQuery(RoomID, GroupID);

        // Register startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatMessageSend_" + ClientID, BuildStartupScript(), true);

        // Set link to documentation and tooltip for canned responses
        lnkCannedRespHelp.NavigateUrl = DocumentationHelper.GetDocumentationTopicUrl(CANNED_RESPONSES_HELP_TOPIC);
        lnkCannedRespHelp.ToolTip     = ResHelper.GetString("chat.cannedresponses.helplabel");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatErrors_files/ChatErrors.js");

        // Run script
        string startupScript = String.Format("InitErrorsWebpart({{errorTemplate:{0},contentClientID:{1}, clientID:'{2}', showDeleteAll:{3}, envelopeID: '#envelope_{2}' }});",
                                             ScriptHelper.GetString(ChatUIHelper.GetWebpartTransformation(ErrorTransformationName, "chat.error.transformation.errorwp.error")),
                                             ScriptHelper.GetString("#" + pnlChatErrors.ClientID),
                                             ClientID,
                                             ScriptHelper.GetString(ShowDeleteAllBtn ? ChatUIHelper.GetWebpartTransformation(ButtonDeleteAllTransformationName, "chat.error.transformation.errorwp.deleteallbtn") : "")
                                             );

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatErrors_" + ClientID, startupScript, true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert script references
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatRooms_files/ChatRooms.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/ListPaging.js");

        if (EnableFiltering)
        {
            pnlChatRoomsFiltering.Visible = true;
        }
        // Prepare and run startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatRooms_" + ClientID, BuildStartupScript(), true);

        imgChatRoomsPrompt.ImageUrl        = GetImageUrl("CMSModules/CMS_Chat/lock24.png");
        imgChatRoomsCreatePrompt.ImageUrl  = GetImageUrl("CMSModules/CMS_Chat/message_add24.png");
        imgChatRoomsCreateError.ImageUrl   = GetImageUrl("CMSModules/CMS_Chat/error16.png");
        imgChatRoomsDeletePrompt.ImageUrl  = GetImageUrl("CMSModules/CMS_Chat/sign_forbidden24.png");
        imgChatRoomsAbandonPrompt.ImageUrl = GetImageUrl("CMSModules/CMS_Chat/sign_forbidden24.png");
        imgChatRoomsEditPrompt.ImageUrl    = GetImageUrl("CMSModules/CMS_Chat/message_edit24.png");
        imgChatRoomsEditError.ImageUrl     = GetImageUrl("CMSModules/CMS_Chat/error16.png");
    }
Exemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatRoomName_files/ChatRoomName.js");

        // Run script
        JavaScriptSerializer sr = new JavaScriptSerializer();
        string json             = sr.Serialize(
            new
        {
            roomNameTemplate    = ChatUIHelper.GetWebpartTransformation(ChatRoomNameTransformationName, "chat.error.transformation.namewp.error"),
            contentClientID     = "#" + pnlChatRoomName.ClientID,
            clientID            = ClientID,
            conversationTitle   = ResHelper.GetString("chat.title.privateconversation"),
            groupID             = GroupID,
            displayInitialTitle = DisplayInitialTitle,
            noRoomTitle         = InitialTitle,
            loadingDiv          = ChatUIHelper.GetWebpartLoadingDiv("ChatRoomNameWPLoading", "chat.wploading.roomname"),
            envelopeID          = "#envelope_" + ClientID
        }
            );
        string startupScript = String.Format("InitChatRoomNameWebpart({0});", json);

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatRoomName_" + ClientID, startupScript, true);
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Get information about chat room this window has been opened for.
        int roomId = QueryHelper.GetInteger("windowroomid", 0);

        try
        {
            ChatUserHelper.VerifyChatUserHasJoinRoomRights(roomId);
        }
        catch (ChatServiceException)
        {
            DisplayError();

            return;
        }
        ChatRoomInfo room = ChatRoomInfoProvider.GetChatRoomInfo(roomId);

        if (room == null)
        {
            DisplayError();

            return;
        }

        // Script references insertion
        ScriptHelper.RegisterJQuery(Page);
        ChatScriptHelper.RegisterChatManager(Page);
        ChatScriptHelper.RegisterChatNotificationManager(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/jquery/jquery-resize.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/Pages/Scripts/ChatRoomWindow.js");

        SetWebpartsUp(room.ChatRoomIsSupport);
        lblTitle.Text = HTMLHelper.HTMLEncode(room.ChatRoomDisplayName) + " – " + GetString(room.ChatRoomIsSupport ? "chat.title.support" : "chat.title.privateconversation");
        string json = JsonConvert.SerializeObject(
            new
        {
            roomId,
            pnlChatRoomWindowClientId = pnlChatRoomWindow.ClientID,
            pnlTopClientId            = pnlTop.ClientID,
            pnlBottomClientId         = pnlBottom.ClientID,
            ChatRoomMessagesClientId  = ChatRoomMessagesElem.ClientID,
            btnCloseClientId          = btnCloseWindow.ClientID,
            isSupport = room.ChatRoomIsSupport,
            notificationManagerOptions = new
            {
                eventName   = "newmessage",
                soundFile   = ChatSettingsProvider.EnableSoundSupportChat ? ResolveUrl("~/CMSModules/Chat/CMSPages/Sound/Chat_message.mp3") : String.Empty,
                notifyTitle = GetString("chat.general.newmessages")
            },
            title = lblTitle.Text
        },
            new JsonSerializerSettings {
            StringEscapeHandling = StringEscapeHandling.EscapeHtml
        }
            );
        string startupScript = String.Format("ChatSupportWindow({0});", json);

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatSupportWindow", startupScript, true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert cript references
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/ListPaging.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/ChatDialogs.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatRoomUsers_files/ChatRoomUsers.js");

        RoomID = ChatUIHelper.GetRoomIdFromQuery(RoomID, GroupID);

        if (EnableFiltering)
        {
            pnlChatRoomUsersFiltering.Visible = true;
        }

        // Set properties to invite webpart
        ChatSearchOnlineUsers.InviteMode = ChatOnlineUsersElem.InviteMode = true;
        ChatSearchOnlineUsers.IsSupport  = ChatOnlineUsersElem.IsSupport = IsSupport;
        ChatSearchOnlineUsers.GroupName  = ChatOnlineUsersElem.GroupName = GroupID;
        ChatSearchOnlineUsers.OnlineUserTransformationName = ChatOnlineUsersElem.OnlineUserTransformationName = "Chat.Transformations.ChatOnlineUser";
        ChatSearchOnlineUsers.PagingEnabled = ChatOnlineUsersElem.EnablePaging = true;
        int invitePagingItems = (ChatSettingsProvider.WPInviteModePagingItems > 0) ? ChatSettingsProvider.WPInviteModePagingItems : ChatSettingsProvider.WPPagingItems;

        if (!(invitePagingItems > 0))
        {
            invitePagingItems = PagingItems;
        }
        ChatOnlineUsersElem.ShowFilterItems    = invitePagingItems + 1;
        ChatSearchOnlineUsers.PagingItems      = ChatOnlineUsersElem.PagingItems = invitePagingItems;
        ChatSearchOnlineUsers.ResponseMaxUsers = (InviteSearchModeMaxUsers >= 0) ? InviteSearchModeMaxUsers : ChatSettingsProvider.WPSearchModeMaxUsers;
        ChatOnlineUsersElem.EnableFiltering    = true;

        if (InviteSearchMode == true)
        {
            ChatOnlineUsersElem.Visible = false;
        }
        else
        {
            ChatSearchOnlineUsers.Visible = false;
        }

        // Run startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatUsers_" + ClientID, BuildStartupScript(), true);

        imgChatRoomUsersInvitePrompt.ImageUrl = GetImageUrl("CMSModules/CMS_Chat/add24.png");
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (StopProcessing || !ViewMode.IsOneOf(ViewModeEnum.LiveSite, ViewModeEnum.Preview))
        {
            return;
        }

        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ScriptHelper.RegisterJQuery(Page);
        ScriptHelper.RegisterJQueryCookie(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/ChatSettings.ashx");

        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/AutoInitiatedChat_files/AutoInitiatedChat.js");

        int optID = ChatPopupWindowSettingsHelper.Store(ChatMessageTransformationName, ChatRoomUserTransformationName, ChatErrorTransformationName, ChatErrorDeleteAllButtonTransformationName);

        // Run script
        string json = JsonConvert.SerializeObject(
            new
        {
            wpGUID        = InstanceGUID,
            clientID      = pnlInitiatedChat.ClientID,
            contentID     = pnlContent.ClientID,
            pnlErrorID    = pnlError.ClientID,
            lblErrorID    = lblError.ClientID,
            windowURL     = ChatUIHelper.GetChatRoomWindowURL(),
            trans         = ChatUIHelper.GetWebpartTransformation(TransformationName, "chat.error.transformation.initiatedchat.error"),
            guid          = optID,
            delay         = Delay * 1000,
            initiatorName = InitiatorName,
            messages      = MacroResolver.Resolve(Messages).Split('\n')
        },
            new JsonSerializerSettings {
            StringEscapeHandling = StringEscapeHandling.EscapeHtml
        }
            );
        string startupScript = string.Format("InitAutoInitiatedChat({0});", json);

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatAutoInitiatedChat_" + ClientID, startupScript, true);
    }
Exemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert script references
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatLogin_files/ChatLogin.js");

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatLogin_" + ClientID, BuildStartupScript(), true);
    }
Exemplo n.º 12
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (!Visible || !ChatProtectionHelper.IsSupportChatPanelEnabled() || MembershipContext.SignOutPending)
        {
            Visible = false;

            return;
        }

        // Script references insertion
        ChatScriptHelper.RegisterChatSupportManager(Page);
        ChatScriptHelper.RegisterChatNotificationManager(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/Controls/SupportChatHeader.js");

        // Create and launch startup script.
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "SupportChatHeader_" + ClientID, GetStartupScript(), true);
    }
Exemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!ViewMode.IsOneOf(ViewModeEnum.LiveSite, ViewModeEnum.Preview))
        {
            return;
        }

        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion
        ScriptHelper.RegisterJQuery(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/ChatSettings.ashx");

        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/InitiatedChat_files/InitiatedChat.js");

        int optID = ChatPopupWindowSettingsHelper.Store(ChatMessageTransformationName, ChatRoomUserTransformationName, ChatErrorTransformationName, ChatErrorDeleteAllButtonTransformationName);

        // Run script
        JavaScriptSerializer sr = new JavaScriptSerializer();
        string json             = sr.Serialize(
            new
        {
            clientID   = pnlInitiatedChat.ClientID,
            contentID  = pnlContent.ClientID,
            pnlErrorID = pnlError.ClientID,
            lblErrorID = lblError.ClientID,
            windowURL  = ChatUIHelper.GetChatRoomWindowURL(),
            trans      = ChatUIHelper.GetWebpartTransformation(TransformationName, "chat.error.transformation.initiatedchat.error"),
            guid       = optID,
            pingTick   = ChatSettingsProvider.GlobalPingIntervalSetting * 1000
        }
            );
        string startupScript = string.Format("InitInitiatedChatManager({0});", json);

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatInitiatedChat_" + ClientID, startupScript, true);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Registration to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion

        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatSupportRequest_files/ChatSupportRequest.js");

        // Create and store settings for popup chat window.
        int id = ChatPopupWindowSettingsHelper.Store(ChatMessageTransformationName, ChatRoomUserTransformationName, ChatErrorTransformationName, ChatErrorDeleteAllButtonTransformationName);

        string json = JsonConvert.SerializeObject(
            new
        {
            onlineUrl            = ChatUIHelper.GetChatRoomWindowURL(),
            clientID             = pnlSupportChatRequest.ClientID,
            guid                 = id,
            trans                = ChatUIHelper.GetWebpartTransformation(string.IsNullOrEmpty(ChatSupportRequestTransformationName) ? ChatSettingsProvider.TransformationSupportRequest : ChatSupportRequestTransformationName, "chat.error.transformation.request"),
            mailEnabled          = ChatSettingsProvider.IsSupportMailEnabledAndValid,
            pnlInformDialog      = "#" + pnlChatSupportRequestInfoDialog.ClientID,
            btnInformDialogClose = "#" + btnChatSupportRequestInformDialogClose.ClientID
        },
            new JsonSerializerSettings {
            StringEscapeHandling = StringEscapeHandling.EscapeHtml
        }
            );

        string startupScript = String.Format("ChatSupportRequest({0});", json);

        // Run startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "SupportChatRequest_" + ClientID, startupScript, true);
    }
Exemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;
        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert script references
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterJQueryTemplates(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/BBCodeParser.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/SmileysResolver.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatRoomMessages_files/ChatRoomMessages.js");

        imgInformationDialog.ImageUrl = GetImageUrl("General/Labels/Information.png");

        RoomID = ChatUIHelper.GetRoomIdFromQuery(RoomID, GroupID);

        // Prepare and run startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatMessages_" + ClientID, BuildStartupScript(), true);
    }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!ObjectFactory <ILicenseService> .StaticSingleton().IsFeatureAvailable(FeatureEnum.Chat))
        {
            ShowError();
            return;
        }

        // Register to chat webservice
        AbstractCMSPage cmsPage = Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Insert cript references
        ChatScriptHelper.RegisterChatManager(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSWebParts/Chat/ChatWebpart_files/ChatWebpart.js");

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatWebpart_" + ClientID, string.Format("InitChatWebpart('{0}');", pnlChatWebpartHeader.ClientID), true);

        SetUpWebparts();
    }
Exemplo n.º 17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PageTitle title = PageTitle;

        passwordPromptElem.TitleText = ResHelper.GetString("chat.password");

        // Script references insertion
        ScriptHelper.RegisterJQuery(Page);
        ChatScriptHelper.RegisterChatNotificationManager(Page);
        ScriptHelper.RegisterScriptFile(Page, "~/CMSScripts/jquery/jquery-resize.js");
        ScriptHelper.RegisterScriptFile(Page, "~/CMSModules/Chat/CMSPages/Scripts/ChatRoomWindow.js");

        // Get information about chat room this window has been opened for.
        int roomID = QueryHelper.GetInteger("windowroomid", 0);

        try
        {
            ChatUserHelper.VerifyChatUserHasJoinRoomRights(roomID);
        }
        catch (ChatServiceException)
        {
            DisplayError();

            return;
        }

        ChatRoomInfo room = ChatRoomInfoProvider.GetChatRoomInfo(roomID);

        if (room == null)
        {
            DisplayError();

            return;
        }

        string pnlChatRoomWindowCssClass = " ChatPopupWindow";

        // Disable irrelevant controls
        if (room.ChatRoomIsOneToOne)
        {
            ChatMessageSendElem.HideUserPicker();
            pnlChatRoomWindowCssClass += " IsOneToOne";

            // Set appropriate window title
            string pageTitle = ResHelper.GetString(room.ChatRoomIsSupport ? "chat.title.support" : "chat.title.privateconversation");
            Page.Header.Title = title.TitleText = pageTitle;
        }
        else
        {
            Page.Header.Title = title.TitleText = room.ChatRoomDisplayName;
        }

        SetWebpartsUp();

        if (room.ChatRoomIsSupport)
        {
            pnlChatRoomWindowCssClass += " IsSupport";
            if (ChatSettingsProvider.IsSupportMailEnabledAndValid)
            {
                pnlSupportSendMail.Visible     = true;
                hplSupportSendMail.NavigateUrl = ChatSettingsProvider.SupportMailDialogURL + "?roomid=" + roomID;
                hplSupportSendMail.Target      = "_blank";
            }
        }
        pnlChatRoomWindow.CssClass += pnlChatRoomWindowCssClass;
        JavaScriptSerializer sr = new JavaScriptSerializer();

        string json = sr.Serialize(
            new
        {
            roomID   = roomID,
            password = room.HasPassword,
            pnlChatRoomPasswordPrompt       = '#' + pnlChatRoomPasswordPrompt.ClientID,
            txtChatRoomPasswordPromptInput  = '#' + txtChatRoomPasswordPromptInput.ClientID,
            btnChatRoomPasswordPromptSubmit = '#' + btnChatRoomPasswordPromptSubmit.ClientID,
            isOneToOne                 = room.IsWhisperRoom,
            isCustomerSupport          = room.ChatRoomIsSupport,
            hplSupportSendMailClientID = room.ChatRoomIsSupport ? '#' + hplSupportSendMail.ClientID : "",
            pnlPasswordPromptError     = '#' + pnlChatRoomsPromptPasswordError.ClientID,
            pnlChatRoomWindow          = '#' + pnlChatRoomWindow.ClientID,
            ChatRoomMessagesClientID   = ChatRoomMessagesElem.ClientID,
            btnClose = "#" + btnCloseWindow.ClientID,
            notificationManagerOptions = new
            {
                eventName   = "newmessage",
                soundFile   = ChatSettingsProvider.EnableSoundLiveChat ? ResolveUrl("~/CMSModules/Chat/CMSPages/Sound/Chat_message.mp3") : String.Empty,
                notifyTitle = ResHelper.GetString("chat.general.newmessages")
            }
        }
            );


        string startupScript = String.Format("ChatRoomWindow({0});", json);

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatRoomWindow_" + ClientID, startupScript, true);
    }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int roomID = QueryHelper.GetInteger("roomid", 0);

        ChatRoomMessages.RoomID = roomID;

        ChatRoomInfo room = ChatRoomInfoProvider.GetChatRoomInfo(roomID);

        if (room != null)
        {
            if (!room.ChatRoomEnabled)
            {
                CssRegistration.RegisterBootstrap(Page);
                CssRegistration.RegisterDesignMode(Page);
                ShowError(GetString("chat.errormessage.roomdisabled"));
                pnlChatView.Visible = false;

                return;
            }

            ChatOnlineUserHelper.LogInChatUser(ChatUserHelper.GetChatUserFromCMSUser(MembershipContext.AuthenticatedUser), false);
            ChatRoomUserHelper.JoinUserToRoom(room.ChatRoomID, ChatUserHelper.GetChatUserFromCMSUser(), room.ChatRoomPassword, false);
        }

        ChatRoomUsers.ChatUserTransformationName = "Chat.Transformations.CMSChatRoomUser";
        ChatRoomUsers.EnableFiltering            = true;
        ChatRoomUsers.ShowFilterItems            = ChatSettingsProvider.WPShowFilterLimit;
        ChatRoomUsers.EnablePaging = true;
        ChatRoomUsers.PagingItems  = ChatSettingsProvider.WPPagingItems;
        ChatRoomUsers.GroupPagesBy = ChatSettingsProvider.WPGroupPagesBy;
        ChatRoomUsers.ChatErrorDeleteAllButtonTransformationName = "Chat.Transformations.CMSChatErrorDeleteAllButton";
        ChatRoomUsers.ChatErrorTransformationName    = "Chat.Transformations.CMSChatError";
        ChatRoomUsers.ChatMessageTransformationName  = "Chat.Transformations.CMSChatMessage";
        ChatRoomUsers.ChatRoomUserTransformationName = "Chat.Transformations.CMSChatRoomUser";

        RoomName.ChatRoomNameTransformationName = "Chat.Transformations.CMSRoomName";
        RoomName.DisplayInitialTitle            = false;

        ChatNotification.NotificationTransformation = "Chat.Transformations.CMSChatNotification";
        ChatNotification.ChatErrorDeleteAllButtonTransformationName = "Chat.Transformations.CMSChatErrorDeleteAllButton";
        ChatNotification.ChatErrorTransformationName    = "Chat.Transformations.CMSChatError";
        ChatNotification.ChatMessageTransformationName  = "Chat.Transformations.CMSChatMessage";
        ChatNotification.ChatRoomUserTransformationName = "Chat.Transformations.CMSChatRoomUser";
        ChatNotification.EnableNotificationBubble       = false;

        ChatErrors.ErrorTransformationName           = "Chat.Transformations.CMSChatError";
        ChatErrors.ShowDeleteAllBtn                  = true;
        ChatErrors.ButtonDeleteAllTransformationName = "Chat.Transformations.CMSChatErrorDeleteAllButton";

        ChatRoomMessages.ChatMessageTransformationName = "Chat.Transformations.CMSChatMessage";
        ChatRoomMessages.Count     = 100;
        ChatRoomMessages.Direction = ChatRoomMessagesDirectionEnum.Down;


        // Registration to chat webservice
        AbstractCMSPage cmsPage = this.Page as AbstractCMSPage;

        if (cmsPage != null)
        {
            ChatScriptHelper.RegisterChatSupportAJAXProxy(cmsPage);
        }
    }