private void SetWebpartsUp(bool isSupport) { // Set errors webpart up. ChatErrorsElem.ErrorTransformationName = "Chat.Transformations.CMSChatError"; ChatErrorsElem.ButtonDeleteAllTransformationName = "Chat.Transformations.CMSChatErrorDeleteAllButton"; ChatErrorsElem.ShowDeleteAllBtn = true; ChatErrorsElem.IsSupport = isSupport; // Set messages webpart up. ChatRoomMessagesElem.ChatMessageTransformationName = "Chat.Transformations.CMSChatMessage"; ChatRoomMessagesElem.Direction = ChatRoomMessagesDirectionEnum.Up; ChatRoomMessagesElem.Count = ChatSettingsProvider.FirstLoadMessagesCountSetting; ChatRoomMessagesElem.IsSupport = isSupport; // Set users webpart up. ChatRoomUsersElem.ChatUserTransformationName = "Chat.Transformations.CMSChatRoomUser"; ChatRoomUsersElem.EnablePaging = true; ChatRoomUsersElem.PagingItems = 5; ChatRoomUsersElem.EnableFiltering = false; ChatRoomUsersElem.SortByStatus = true; ChatRoomUsersElem.InviteEnabled = false; ChatRoomUsersElem.IsSupport = isSupport; // Set send webpart up ChatMessageSendElem.IsSupport = isSupport; ChatMessageSendElem.HideUserPicker(); }
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); }
protected void Page_Load(object sender, EventArgs e) { PageTitle title = CurrentMaster.Title; title.TitleImage = GetImageUrl("CMSModules/CMS_Chat/list.png"); passwordPromptElem.TitleImage = GetImageUrl("CMSModules/CMS_Chat/password.png"); passwordPromptElem.TitleText = ResHelper.GetString("chat.password"); // Script references insertion ScriptHelper.RegisterJQuery(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); ChatRoomInfo room = ChatRoomInfoProvider.GetChatRoomInfo(roomID); if (room == null) { lblError.Text = ResHelper.GetString("chat.error.window.badroomid"); lblError.Visible = true; 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"); if (room.ChatRoomIsSupport && IsSupport) { pageTitle = room.ChatRoomDisplayName + " – " + pageTitle; } Page.Header.Title = title.TitleText = pageTitle; } else { Page.Header.Title = title.TitleText = room.ChatRoomDisplayName; } SetWebpartsUp(); // True if this window is open by a customer in need of support (not support engineer) bool isCustomerSupport = room.ChatRoomIsSupport && !IsSupport; if (room.ChatRoomIsSupport) { pnlChatRoomWindowCssClass += " IsSupport"; } if (isCustomerSupport && ChatHelper.IsSupportMailEnabledAndValid) { pnlSupportSendMail.Visible = true; hplSupportSendMail.NavigateUrl = ChatHelper.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 = isCustomerSupport, hplSupportSendMailClientID = isCustomerSupport ? '#' + hplSupportSendMail.ClientID : "", pnlPasswordPromptError = '#' + pnlChatRoomsPromptPasswordError.ClientID, pnlChatRoomWindow = '#' + pnlChatRoomWindow.ClientID, ChatRoomMessagesClientID = ChatRoomMessagesElem.ClientID, btnClose = "#" + btnCloseWindow.ClientID, isSupport = IsSupport } ); string startupScript = String.Format("ChatRoomWindow({0});", json); ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatRoomWindow_" + ClientID, startupScript, true); }