/// <summary>
    /// Builds startup script.
    /// </summary>
    private string BuildStartupScript()
    {
        int id = ChatPopupWindowSettingsHelper.Store(ChatMessageTransformationName, ChatRoomUserTransformationName, ChatErrorTransformationName, ChatErrorDeleteAllButtonTransformationName);

        JavaScriptSerializer sr = new JavaScriptSerializer();
        string json             = sr.Serialize(
            new
        {
            onlineUserTemplate = ChatHelper.GetWebpartTransformation(OnlineUserTransformationName, "chat.error.transformation.users.onlineuser"),
            chatRoomWindowUrl  = ChatHelper.GetChatRoomWindowURL(Page),
            clientID           = ClientID,
            GUID            = id,
            contentClientID = pnlChatSearchOnlineUsers.ClientID,
            textbox         = txtChatSearchOnlineUsers.ClientID,
            button          = btnChatSearchOnlineUsers.ClientID,
            pnlPaging       = pnlChatSearchOnlineUsersPaging.ClientID,
            pagingEnabled   = PagingEnabled,
            pagingItems     = PagingItems > 0 ? PagingItems : ChatHelper.WPPagingItems,
            groupPagesBy    = GroupPagesBy >= 0 ? GroupPagesBy : ChatHelper.WPGroupPagesBy,
            maxUsers        = ResponseMaxUsers,
            inviteMode      = InviteMode,
            loadingDiv      = ChatHelper.GetWebpartLoadingDiv("ChatSearchOnlineUsersWPLoading", "chat.wploading.searchonlineusers"),
            resStrMoreFound = (ResponseMaxUsers > 0) ? String.Format(ResHelper.GetString("chat.searchonlineusers.morefound"), ResponseMaxUsers) : "",
            resStrNotFound  = ResHelper.GetString("chat.searchonlineusers.notfound"),
            pnlInfo         = pnlChatSearchOnlineUsersInfo.ClientID,
            resStrFound     = ResHelper.GetString("chat.searchonlineusers.results"),
            envelopeID      = "envelope_" + ClientID,
            groupID         = GroupName,
            invitePanel     = pnlChatSearchOnlineUsersInvite.ClientID
        }
            );

        return(String.Format("InitChatSearchOnlineUsersWebpart({0});", json));
    }
    /// <summary>
    /// Builds startup script.
    /// </summary>
    private string BuildStartupScript()
    {
        int id = ChatPopupWindowSettingsHelper.Store(ChatMessageTransformationName, ChatRoomUserTransformationName, ChatErrorTransformationName, ChatErrorDeleteAllButtonTransformationName);

        JavaScriptSerializer sr = new JavaScriptSerializer();
        string json             = sr.Serialize(
            new
        {
            onlineUserTemplate = ChatHelper.GetWebpartTransformation(OnlineUserTransformationName, "chat.error.transformation.users.onlineuser"),
            chatRoomWindowUrl  = ChatHelper.GetChatRoomWindowURL(),
            clientID           = ClientID,
            GUID                  = id,
            contentClientID       = pnlChatOnlineUsers.ClientID,
            inviteMode            = InviteMode,
            pnlFilterClientID     = pnlChatOnlineUsersFiltering.ClientID,
            pnlPagingClientID     = pnlChatOnlineUsersPaging.ClientID,
            pagingItems           = PagingItems > 0 ? PagingItems : ChatHelper.WPPagingItems,
            pagingEnabled         = EnablePaging,
            btnFilter             = btnChatOnlineUsersFilter.ClientID,
            txtFilter             = txtChatOnlineUsersFilter.ClientID,
            filterEnabled         = EnableFiltering,
            pnlInfo               = pnlChatOnlineUsersInfo.ClientID,
            resStrNoFound         = ResHelper.GetString("chat.onlineusers.notfound"),
            resStrResults         = ResHelper.GetString("chat.onlineusers.results"),
            loadingDiv            = ChatHelper.GetWebpartLoadingDiv("ChatOnlineUsersWPLoading", "chat.wploading.onlineusers"),
            filterCount           = ShowFilterItems >= 0 ? ShowFilterItems : ChatHelper.WPShowFilterLimit,
            envelopeID            = "envelope_" + ClientID,
            resStrNoOneInviteMode = ResHelper.GetString("chat.onlineusers.invitemodenousers"),
            groupID               = GroupName,
            invitePanel           = pnlChatOnlineUsersInvite.ClientID
        }
            );

        return(String.Format("InitChatOnlineUsersWebpart({0});", json));
    }
Beispiel #3
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)
        {
            ChatHelper.RegisterChatAJAXProxy(cmsPage);
        }

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

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

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

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

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "ChatAutoInitiatedChat_" + ClientID, startupScript, true);
    }
Beispiel #4
0
    /// <summary>
    /// Builds startup script.
    /// </summary>
    private string BuildStartupScript()
    {
        int id = ChatPopupWindowSettingsHelper.Store(ChatMessageTransformationName, ChatRoomUserTransformationName, ChatErrorTransformationName, ChatErrorDeleteAllButtonTransformationName);

        JavaScriptSerializer sr = new JavaScriptSerializer();
        string json             = sr.Serialize(
            new
        {
            roomID                        = RoomID,
            chatUserTemplate              = ChatHelper.GetWebpartTransformation(ChatUserTransformationName, "chat.error.transformation.users.user"),
            oneToOneURL                   = ChatHelper.GetChatRoomWindowURL(Page),
            contentClientID               = pnlChatRoomUsers.ClientID,
            clientID                      = ClientID,
            groupID                       = GroupID,
            sortByStatus                  = SortByStatus,
            GUID                          = id,
            pnlChatRoomUsersInvitePrompt  = pnlChatRoomUsersInvitePrompt.ClientID,
            pnlChatRoomUsersInvite        = pnlChatRoomUsersInvite.ClientID,
            chatOnlineUsersElem           = ChatOnlineUsersElem.ClientID,
            chatSearchOnlineUsersElem     = ChatSearchOnlineUsers.ClientID,
            loadingDiv                    = ChatHelper.GetWebpartLoadingDiv("ChatRoomUsersWPLoading", "chat.wploading.roomusers"),
            btnChatRoomUsersInvite        = btnChatRoomUsersInvite.ClientID,
            btnChatRoomsDeletePromptClose = btnChatRoomsDeletePromptClose.ClientID,
            pnlFilterClientID             = pnlChatRoomUsersFiltering.ClientID,
            pnlPagingClientID             = pnlChatRoomUsersPaging.ClientID,
            pagingItems                   = PagingItems > 0 ? PagingItems : ChatHelper.WPPagingItems,
            groupPagesBy                  = GroupPagesBy >= 0 ? GroupPagesBy : ChatHelper.WPGroupPagesBy,
            pagingEnabled                 = EnablePaging,
            btnFilter                     = btnChatRoomUsersFilter.ClientID,
            txtFilter                     = txtChatRoomUsersFilter.ClientID,
            filterEnabled                 = EnableFiltering,
            pnlInfo                       = pnlChaRoomUsersInfo.ClientID,
            resStrNoFound                 = ResHelper.GetString("chat.searchonlineusers.notfound"),
            resStrResults                 = ResHelper.GetString("chat.searchonlineusers.results"),
            filterCount                   = ShowFilterItems >= 0 ? ShowFilterItems : ChatHelper.WPShowFilterLimit,
            envelopeID                    = "envelope_" + ClientID,
            inviteSearchMode              = InviteSearchMode,
            inviteEnabled                 = InviteEnabled
        }
            );

        return(String.Format("InitChatUsersWebpart({0});", json));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!((ViewMode == ViewModeEnum.LiveSite) || (ViewMode == ViewModeEnum.Preview)))
        {
            return;
        }

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

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

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

        ScriptHelper.RegisterScriptFile(Page, "jquery/jquery-tmpl.js");
        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  = ChatHelper.GetChatRoomWindowURL(),
            trans      = ChatHelper.GetWebpartTransformation(TransformationName, "chat.error.transformation.initiatedchat.error"),
            guid       = optID,
            pingTick   = ChatHelper.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)
        {
            ChatHelper.RegisterChatAJAXProxy(cmsPage);
        }

        // Script references insertion

        ChatHelper.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);

        JavaScriptSerializer sr = new JavaScriptSerializer();
        string json             = sr.Serialize(
            new
        {
            onlineUrl            = ChatHelper.GetChatRoomWindowURL(),
            clientID             = pnlSupportChatRequest.ClientID,
            guid                 = id,
            trans                = ChatHelper.GetWebpartTransformation(string.IsNullOrEmpty(ChatSupportRequestTransformationName) ? ChatHelper.TransformationSupportRequest : ChatSupportRequestTransformationName, "chat.error.transformation.request"),
            mailEnabled          = ChatHelper.IsSupportMailEnabledAndValid,
            pnlInformDialog      = "#" + pnlChatSupportRequestInfoDialog.ClientID,
            btnInformDialogClose = "#" + btnChatSupportRequestInformDialogClose.ClientID
        }
            );

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

        // Run startup script
        ScriptHelper.RegisterStartupScript(Page, typeof(string), "SupportChatRequest_" + ClientID, startupScript, true);
    }
Beispiel #7
0
    /// <summary>
    /// Create and launch startup script
    /// </summary>
    /// <param name="settingsId">ID of popup window settings</param>
    private void RegisterStartupScript()
    {
        JavaScriptSerializer sr = new JavaScriptSerializer();

        string json = sr.Serialize(
            new
        {
            imgStatus                  = imgChat.ClientID,
            controlID                  = pnlSupportChat.ClientID,
            tick                       = 5000,
            contextMenuID              = menuCont.MenuID,
            drpNewMessageWarningID     = drpNewMessageWarning.ClientID,
            lblErrorID                 = lblError.ClientID,
            pnlErrorID                 = pnlError.ClientID,
            pnlNotificationBubbleID    = pnlNotificationBubble.ClientID,
            btnHideBubbleID            = imgHideBubble.ClientID,
            lblBubbleTitleID           = lblNOtificationBubleTitle.ClientID,
            youAreAvailableText        = ResHelper.GetString("chat.support.youreavailable"),
            youAreNotAvailableText     = ResHelper.GetString("chat.support.youreunavailable"),
            selectRoomToOpen           = ResHelper.GetString("chat.support.selectroom"),
            newMessagesFormat          = ResHelper.GetString("chat.support.newmessages"),
            newSupportRequestsSingular = ResHelper.GetString("chat.support.newrequestssingular"),
            newSupportRequestsPlural   = ResHelper.GetString("chat.support.newrequestsplural"),
            noNewSupportRequests       = ResHelper.GetString("chat.support.nonewrequests"),
            newMessagesTitle           = ResHelper.GetString("chat.general.newmessages"),
            imgOnlineSrc               = GetImageUrl("CMSModules/CMS_Chat/support_header_on.png"),
            imgOfflineSrc              = GetImageUrl("CMSModules/CMS_Chat/support_header_off.png"),
            popupWindowUrl             = ChatHelper.GetChatRoomWindowURL() + "?isSupport=1&windowroomid={RoomIDParam}",
            settingsUrl                = URLHelper.GetAbsoluteUrl("~/CMSModules/Chat/Pages/ChatSupportSettings.aspx"),
            strCloseError              = ResHelper.GetString("chat.support.errorclose"),
            popupWindowError           = ResHelper.GetString("chat.settings.popupwindowerrormsg")
        }
            );

        string startupScript = String.Format("jQuery(function(){{ InitChatSupportManager({0}); }});", json);

        ScriptHelper.RegisterStartupScript(Page, typeof(string), "SupportChatHeader_" + ClientID, startupScript, true);
    }