コード例 #1
0
    protected void srchDialog_DoSearch()
    {
        // Log "internal search" activity
        Activity internalSearch = new ActivityInternalSearch(srchDialog.SearchForTextBox.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);

        internalSearch.Log();
    }
コード例 #2
0
    /// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        if (!string.IsNullOrEmpty(txtWord.Text))
        {
            string url = SearchResultsPageUrl;

            if (url.StartsWithCSafe("~"))
            {
                url = ResolveUrl(url.Trim());
            }

            if (url.Contains("?"))
            {
                url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                url = URLHelper.RemoveParameterFromUrl(url, "searchMode");
            }

            url = URLHelper.AddParameterToUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
            url = URLHelper.AddParameterToUrl(url, "searchMode", SearchMode.ToString());

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtWord.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            URLHelper.Redirect(url.Trim());
        }
    }
コード例 #3
0
 protected void srchDialog_DoSearch()
 {
     if (!doSearch)
     {
         doSearch = true;
         // Log "internal search" activity
         Activity internalSearch = new ActivityInternalSearch(srchDialog.SearchForTextBox.Text, CMSContext.CurrentDocument, CMSContext.ActivityEnvironmentVariables);
         internalSearch.Log();
     }
 }
コード例 #4
0
    /// <summary>
    /// Logs "internal search" activity and web analytics "on-site" search keyword.
    /// </summary>
    private void LogPredictiveSearch(string keywords)
    {
        if (PredictiveSearchLogSearchActivity)
        {
            Activity internalSearch = new ActivityInternalSearch(keywords, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();
        }

        if (PredictiveSearchTrackSearchKeywords)
        {
            AnalyticsHelper.LogOnSiteSearchKeywords(SiteContext.CurrentSiteName, DocumentContext.CurrentAliasPath, DocumentContext.CurrentDocumentCulture.CultureCode, keywords, 0, 1);
        }
    }
コード例 #5
0
ファイル: MyPredictiveSearch.cs プロジェクト: rhutnyk/Samples
    private static void LogPredictiveSearch(string keywords, bool PredictiveSearchLogSearchActivity, bool PredictiveSearchTrackSearchKeywords, int DocumentID, int UserID, bool forceLogging)
    {
        if (PredictiveSearchLogSearchActivity || PredictiveSearchTrackSearchKeywords || forceLogging)
        {
            TreeNode currentDocument = (TreeNode)CacheLastN(10, 60, new Func <int, int, TreeNode>(GetDocument), UserID, DocumentID);

            if (PredictiveSearchLogSearchActivity || forceLogging)
            {
                Activity internalSearch = new ActivityInternalSearch(keywords, currentDocument, AnalyticsContext.ActivityEnvironmentVariables);
                internalSearch.Log();
            }

            if (PredictiveSearchTrackSearchKeywords || forceLogging)
            {
                AnalyticsHelper.LogOnSiteSearchKeywords(SiteContext.CurrentSiteName, currentDocument.NodeAliasPath, currentDocument.DocumentCulture, keywords, 0, 1);
            }
        }
    }
コード例 #6
0
    /// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        string url = SearchResultsPageUrl;

        if (url.StartsWithCSafe("~"))
        {
            url = ResolveUrl(url.Trim());
        }

        url = URLHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
        url = URLHelper.UpdateParameterInUrl(url, "searchmode", SearchMode.ToStringRepresentation());

        // Log "internal search" activity
        Activity internalSearch = new ActivityInternalSearch(txtWord.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);

        internalSearch.Log();

        // Try remove paging parameter
        url = URLHelper.RemoveParameterFromUrl(url, "page");

        URLHelper.Redirect(url.Trim());
    }
コード例 #7
0
    /// <summary>
    /// OnGo search click.
    /// </summary>
    protected void btnGo_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(txtSearch.Text))
        {
            string contextQuery = String.Empty;

            if (SearchInCurrentContext)
            {
                if ((ForumContext.CurrentForum != null) && (ForumContext.CurrentThread != null) && (ForumContext.CurrentThread.PostForumID == ForumContext.CurrentForum.ForumID))
                {
                    contextQuery = "&searchforums=" + ForumContext.CurrentForum.ForumID + "&searchthread=" + ForumContext.CurrentThread.PostId;
                }
                else if (ForumContext.CurrentForum != null)
                {
                    contextQuery = "&searchforums=" + ForumContext.CurrentForum.ForumID;
                }
            }

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtSearch.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            if (!String.IsNullOrEmpty(RedirectUrl.Trim()))
            {
                URLHelper.Redirect(ResolveUrl(RedirectUrl) + "?searchtext=" + HttpUtility.UrlEncode(txtSearch.Text) + contextQuery);
            }
            else //Redirect back to current page
            {
                string url = URLHelper.RemoveQuery(RequestContext.CurrentURL);
                url  = URLHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(txtSearch.Text));
                url  = URLHelper.RemoveParameterFromUrl(url, "searchforums");
                url  = URLHelper.RemoveParameterFromUrl(url, "searchthread");
                url += contextQuery;

                URLHelper.Redirect(url);
            }
        }
    }
コード例 #8
0
    /// <summary>
    /// Fires at btn search click.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="e">Arguments</param>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string url = RequestContext.CurrentURL;

        // Remove pager query string
        url = URLHelper.RemoveParameterFromUrl(url, "page");

        // Update search text parameter
        url = URLHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(txtSearchFor.Text));

        // Update search mode parameter
        url = URLHelper.RemoveParameterFromUrl(url, "searchmode");
        if (ShowSearchMode)
        {
            url = URLHelper.AddParameterToUrl(url, "searchmode", drpSearchMode.SelectedValue);
        }
        else
        {
            url = URLHelper.AddParameterToUrl(url, "searchmode", SearchMode.ToStringRepresentation());
        }

        // Add filter params to url
        foreach (string urlParam in FilterUrlParameters)
        {
            string[] urlParams = urlParam.Split('=');
            url = URLHelper.UpdateParameterInUrl(url, urlParams[0], urlParams[1]);
        }

        // Log "internal search" activity
        Activity internalSearch = new ActivityInternalSearch(txtSearchFor.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);

        internalSearch.Log();

        // Redirect
        URLHelper.Redirect(url);
    }
コード例 #9
0
    private static void LogPredictiveSearch(string keywords, bool PredictiveSearchLogSearchActivity, bool PredictiveSearchTrackSearchKeywords, int DocumentID, int UserID, bool forceLogging)
    {
        if (PredictiveSearchLogSearchActivity || PredictiveSearchTrackSearchKeywords || forceLogging)
        {
            TreeNode currentDocument = (TreeNode)CacheLastN(10, 60, new Func<int, int, TreeNode>(GetDocument), UserID, DocumentID);

            if (PredictiveSearchLogSearchActivity || forceLogging)
            {
                Activity internalSearch = new ActivityInternalSearch(keywords, currentDocument, AnalyticsContext.ActivityEnvironmentVariables);
                internalSearch.Log();
            }

            if (PredictiveSearchTrackSearchKeywords || forceLogging)
            {
                AnalyticsHelper.LogOnSiteSearchKeywords(SiteContext.CurrentSiteName, currentDocument.NodeAliasPath, currentDocument.DocumentCulture, keywords, 0, 1);
            }
        }
    }
コード例 #10
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string errMsg = ValidateSearchDialog();

        // Search dialog filled properly
        if (errMsg == string.Empty)
        {
            // Generate query string according search dialog selections
            string queryString = String.Empty;
            queryString += (!string.IsNullOrEmpty(txtSearchText.Text)) ? "searchtext=" + HttpUtility.UrlEncode(txtSearchText.Text) + "&" : "";
            queryString += (!string.IsNullOrEmpty(txtUserName.Text)) ? "searchusername="******"&" : "";
            queryString += (!string.IsNullOrEmpty(drpSearchIn.SelectedValue)) ? "searchin=" + drpSearchIn.SelectedValue + "&" : "";
            queryString += (!string.IsNullOrEmpty(drpSearchOrderBy.SelectedValue)) ? "searchorderby=" + drpSearchOrderBy.SelectedValue + "&" : "";
            queryString += (!string.IsNullOrEmpty(rblSearchOrder.SelectedValue)) ? "searchorder=" + rblSearchOrder.SelectedValue + "&" : "";
            queryString = queryString.TrimEnd('&');

            if (EnableForumSelection)
            {
                string forQuery = "";
                bool allForums = false;

                // If no forum selected
                if (listForums.SelectedIndex < 0)
                {
                    allForums = true;
                    queryString += "&allforums=" + allForums;
                }

                foreach (ListItem li in listForums.Items)
                {
                    if ((li.Selected != allForums) && (li.Value != ""))
                    {
                        if (forQuery != "")
                        {
                            forQuery += ";";
                        }
                        forQuery += li.Value;
                    }
                }

                if (forQuery != "")
                {
                    queryString += "&searchforums=" + forQuery;
                }
            }

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtSearchText.Text, CMSContext.CurrentDocument, CMSContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            // Redirect to the search result page
            if (!string.IsNullOrEmpty(RedirectUrl))
            {
                if (RedirectUrl.IndexOfCSafe("?") < 0)
                {
                    queryString = "?" + queryString;
                }

                URLHelper.Redirect(ResolveUrl(RedirectUrl) + queryString);
            }
            else
            {
                string url = URLRewriter.CurrentURL;

                // Get rid of previous query string parameters
                if (url.IndexOfCSafe("?") > -1)
                {
                    url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchusername");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchin");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchorderby");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchorder");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchforums");
                    url = URLHelper.RemoveParameterFromUrl(url, "forumid");
                    url = URLHelper.RemoveParameterFromUrl(url, "threadid");
                    url = URLHelper.RemoveParameterFromUrl(url, "thread");
                    url = URLHelper.RemoveParameterFromUrl(url, "postid");
                    url = URLHelper.RemoveParameterFromUrl(url, "mode");
                    url = URLHelper.RemoveParameterFromUrl(url, "replyto");
                    url = URLHelper.RemoveParameterFromUrl(url, "subscribeto");
                    url = URLHelper.RemoveParameterFromUrl(url, "page");
                    url = URLHelper.RemoveParameterFromUrl(url, "allforums");
                }

                // Append query string
                url = URLHelper.AppendQuery(url, queryString);

                //Redirect back to the current page
                URLHelper.Redirect(url);
            }
        }
        else
        {
            // Display error info to the user
            lblInfo.Text = errMsg;
            lblInfo.Visible = true;
        }
    }
コード例 #11
0
 protected void srchDialog_DoSearch()
 {
     if (!doSearch)
     {
         doSearch = true;
         // Log "internal search" activity
         Activity internalSearch = new ActivityInternalSearch(srchDialog.SearchForTextBox.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
         internalSearch.Log();
     }
 }
    /// <summary>
    /// Logs "internal search" activity and web analytics "on-site" search keyword. 
    /// </summary>
    private void LogPredictiveSearch(string keywords)
    {
        if (PredictiveSearchLogSearchActivity)
        {
            Activity internalSearch = new ActivityInternalSearch(keywords, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();
        }

        if (PredictiveSearchTrackSearchKeywords)
        {
            AnalyticsHelper.LogOnSiteSearchKeywords(SiteContext.CurrentSiteName, DocumentContext.CurrentAliasPath, DocumentContext.CurrentDocumentCulture.CultureCode, keywords, 0, 1);
        }
    }
コード例 #13
0
ファイル: ForumSearch.ascx.cs プロジェクト: prsolans/rsg
    /// <summary>
    /// OnGo search click.
    /// </summary>
    protected void btnGo_Click(object sender, EventArgs e)
    {
        if (!String.IsNullOrEmpty(txtSearch.Text))
        {
            string contextQuery = String.Empty;

            if (SearchInCurrentContext)
            {
                if ((ForumContext.CurrentForum != null) && (ForumContext.CurrentThread != null) && (ForumContext.CurrentThread.PostForumID == ForumContext.CurrentForum.ForumID))
                {
                    contextQuery = "&searchforums=" + ForumContext.CurrentForum.ForumID + "&searchthread=" + ForumContext.CurrentThread.PostId;
                }
                else if (ForumContext.CurrentForum != null)
                {
                    contextQuery = "&searchforums=" + ForumContext.CurrentForum.ForumID;
                }
            }

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtSearch.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            if (!String.IsNullOrEmpty(RedirectUrl.Trim()))
            {
                URLHelper.Redirect(ResolveUrl(RedirectUrl) + "?searchtext=" + HttpUtility.UrlEncode(txtSearch.Text) + contextQuery);
            }
            else //Redirect back to current page
            {
                string url = URLHelper.RemoveQuery(RequestContext.CurrentURL);
                url = URLHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(txtSearch.Text));
                url = URLHelper.RemoveParameterFromUrl(url, "searchforums");
                url = URLHelper.RemoveParameterFromUrl(url, "searchthread");
                url += contextQuery;

                URLHelper.Redirect(url);
            }
        }
    }
コード例 #14
0
 protected void srchDialog_DoSearch()
 {
     // Log "internal search" activity
     Activity internalSearch = new ActivityInternalSearch(srchDialog.SearchForTextBox.Text, CMSContext.CurrentDocument, CMSContext.ActivityEnvironmentVariables);
     internalSearch.Log();
 }
    /// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        string url = SearchResultsPageUrl;

        if (url.StartsWithCSafe("~"))
        {
            url = ResolveUrl(url.Trim());
        }

        url = URLHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
        url = URLHelper.UpdateParameterInUrl(url, "searchmode", SearchMode.ToStringRepresentation());

        // Log "internal search" activity
        Activity internalSearch = new ActivityInternalSearch(txtWord.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
        internalSearch.Log();

        // Try remove paging parameter
        url = URLHelper.RemoveParameterFromUrl(url, "page");

        URLHelper.Redirect(url.Trim());
    }
コード例 #16
0
    /// <summary>
    /// Fires at btn search click.
    /// </summary>
    /// <param name="sender">Sender</param>
    /// <param name="e">Arguments</param>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string url = RequestContext.CurrentURL;

        // Remove pager query string
        url = URLHelper.RemoveParameterFromUrl(url, "page");

        // Update search text parameter
        url = URLHelper.UpdateParameterInUrl(url, "searchtext", HttpUtility.UrlEncode(txtSearchFor.Text));

        // Update search mode parameter
        url = URLHelper.RemoveParameterFromUrl(url, "searchmode");
        if (ShowSearchMode)
        {
            url = URLHelper.AddParameterToUrl(url, "searchmode", drpSearchMode.SelectedValue);
        }
        else
        {
            url = URLHelper.AddParameterToUrl(url, "searchmode", SearchMode.ToStringRepresentation());
        }

        // Add filter params to url
        foreach (string urlParam in FilterUrlParameters)
        {
            string[] urlParams = urlParam.Split('=');
            url = URLHelper.UpdateParameterInUrl(url, urlParams[0], urlParams[1]);
        }

        // Log "internal search" activity
        Activity internalSearch = new ActivityInternalSearch(txtSearchFor.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
        internalSearch.Log();

        // Redirect
        URLHelper.Redirect(url);
    }
    /// <summary>
    /// Runs the search.
    /// </summary>
    private void Search()
    {
        if (!string.IsNullOrEmpty(txtWord.Text))
        {
            string url = SearchResultsPageUrl;

            if (url.StartsWithCSafe("~"))
            {
                url = ResolveUrl(url.Trim());
            }

            if (url.Contains("?"))
            {
                url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                url = URLHelper.RemoveParameterFromUrl(url, "searchMode");
            }

            url = URLHelper.AddParameterToUrl(url, "searchtext", HttpUtility.UrlEncode(txtWord.Text));
            url = URLHelper.AddParameterToUrl(url, "searchMode", SearchMode.ToString());

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtWord.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            URLHelper.Redirect(url.Trim());
        }
    }
コード例 #18
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        string errMsg = ValidateSearchDialog();

        // Search dialog filled properly
        if (errMsg == string.Empty)
        {
            // Generate query string according search dialog selections
            string queryString = String.Empty;
            queryString += (!string.IsNullOrEmpty(txtSearchText.Text)) ? "searchtext=" + HttpUtility.UrlEncode(txtSearchText.Text) + "&" : "";
            queryString += (!string.IsNullOrEmpty(txtUserName.Text)) ? "searchusername="******"&" : "";
            queryString += (!string.IsNullOrEmpty(drpSearchIn.SelectedValue)) ? "searchin=" + drpSearchIn.SelectedValue + "&" : "";
            queryString += (!string.IsNullOrEmpty(drpSearchOrderBy.SelectedValue)) ? "searchorderby=" + drpSearchOrderBy.SelectedValue + "&" : "";
            queryString += (!string.IsNullOrEmpty(rblSearchOrder.SelectedValue)) ? "searchorder=" + rblSearchOrder.SelectedValue + "&" : "";
            queryString  = queryString.TrimEnd('&');

            if (EnableForumSelection)
            {
                string forQuery  = "";
                bool   allForums = false;

                // If no forum selected
                if (listForums.SelectedIndex < 0)
                {
                    allForums    = true;
                    queryString += "&allforums=" + allForums;
                }

                foreach (ListItem li in listForums.Items)
                {
                    if ((li.Selected != allForums) && (li.Value != ""))
                    {
                        if (forQuery != "")
                        {
                            forQuery += ";";
                        }
                        forQuery += li.Value;
                    }
                }

                if (forQuery != "")
                {
                    queryString += "&searchforums=" + forQuery;
                }
            }

            // Log "internal search" activity
            Activity internalSearch = new ActivityInternalSearch(txtSearchText.Text, DocumentContext.CurrentDocument, AnalyticsContext.ActivityEnvironmentVariables);
            internalSearch.Log();

            // Redirect to the search result page
            if (!string.IsNullOrEmpty(RedirectUrl))
            {
                if (RedirectUrl.IndexOfCSafe("?") < 0)
                {
                    queryString = "?" + queryString;
                }

                URLHelper.Redirect(ResolveUrl(RedirectUrl) + queryString);
            }
            else
            {
                string url = RequestContext.CurrentURL;

                // Get rid of previous query string parameters
                if (url.IndexOfCSafe("?") > -1)
                {
                    url = URLHelper.RemoveParameterFromUrl(url, "searchtext");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchusername");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchin");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchorderby");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchorder");
                    url = URLHelper.RemoveParameterFromUrl(url, "searchforums");
                    url = URLHelper.RemoveParameterFromUrl(url, "forumid");
                    url = URLHelper.RemoveParameterFromUrl(url, "threadid");
                    url = URLHelper.RemoveParameterFromUrl(url, "thread");
                    url = URLHelper.RemoveParameterFromUrl(url, "postid");
                    url = URLHelper.RemoveParameterFromUrl(url, "mode");
                    url = URLHelper.RemoveParameterFromUrl(url, "replyto");
                    url = URLHelper.RemoveParameterFromUrl(url, "subscribeto");
                    url = URLHelper.RemoveParameterFromUrl(url, "page");
                    url = URLHelper.RemoveParameterFromUrl(url, "allforums");
                }

                // Append query string
                url = URLHelper.AppendQuery(url, queryString);

                //Redirect back to the current page
                URLHelper.Redirect(url);
            }
        }
        else
        {
            // Display error info to the user
            lblInfo.Text    = errMsg;
            lblInfo.Visible = true;
        }
    }