Exemple #1
0
        private void RenderCloud(int tagWordCloudSize, int relvance, int relevanceType, int?relatedObjectType, Guid?relatedCommunityID, Guid?relatedUserID)
        {
            QuickTagCloudRelevanceGroup enuRepevance     = (QuickTagCloudRelevanceGroup)relvance;
            QuickTagCloudRelevance      enurelevanceType = (QuickTagCloudRelevance)relevanceType;
            int groupAmount = 24;

            if (relvance > 0)
            {
                if (relvance <= 3)
                {
                    groupAmount = 60;
                }
                else if (relvance <= 5)
                {
                    groupAmount = 24;
                }
                else
                {
                    groupAmount = 16;
                }
            }

            QuickParametersTag quickParametersTag = new QuickParametersTag();

            quickParametersTag.Udc                  = UserDataContext.GetUserDataContext();
            quickParametersTag.IgnoreCache          = false;
            quickParametersTag.Amount               = tagWordCloudSize;
            quickParametersTag.RelevanceGroup       = enuRepevance;
            quickParametersTag.RelevanceGroupAmount = groupAmount;
            quickParametersTag.Relevance            = enurelevanceType;
            if (relatedObjectType.HasValue)
            {
                quickParametersTag.RelatedObjectType = relatedObjectType.Value;
            }
            if (relatedCommunityID.HasValue)
            {
                quickParametersTag.RelatedCommunityID = relatedCommunityID.Value;
            }
            if (relatedUserID.HasValue)
            {
                quickParametersTag.RelatedUserID = relatedUserID.Value;
            }

            List <TagCloudItem> tagCloud = DataObjectTag.GetTagCloud(5, quickParametersTag);

            hasContent = (tagCloud.Count > 0);
            StringBuilder sb = new StringBuilder();

            foreach (TagCloudItem tagWord in tagCloud)
            {
                sb.AppendFormat("<span class=\"t{0}\">&bull; <a href=\"/Tag/{1}\">{2}</a></span> ", tagWord.TagClass, tagWord.Tag.Title, tagWord.Tag.Title);
            }
            this.LitTags.Text = sb.ToString();
        }
Exemple #2
0
        private void SetAutoTagFilter(int amount, int relvance)
        {
            QuickTagCloudRelevanceGroup enuRepevance = (QuickTagCloudRelevanceGroup)relvance;
            int groupAmount = 24;

            if (relvance > 0)
            {
                if (relvance <= 3)
                {
                    groupAmount = 60;
                }
                else if (relvance <= 5)
                {
                    groupAmount = 24;
                }
                else
                {
                    groupAmount = 16;
                }
            }

            QuickParametersTag quickParametersTag = new QuickParametersTag();

            quickParametersTag.Udc                  = UserDataContext.GetUserDataContext();
            quickParametersTag.IgnoreCache          = false;
            quickParametersTag.Amount               = amount;
            quickParametersTag.RelevanceGroup       = enuRepevance;
            quickParametersTag.RelevanceGroupAmount = groupAmount;
            quickParametersTag.Relevance            = QuickTagCloudRelevance.ObjectView;

            if (this._Host.ParentObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                DataObject profileCommunity = DataObject.Load <DataObject>(this._Host.ParentCommunityID);
                quickParametersTag.RelatedUserID = profileCommunity.UserID.Value;
            }
            else if (this._Host.ParentObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                quickParametersTag.RelatedCommunityID = _Host.ParentCommunityID;
            }
            if (this._Host.ParentObjectType == Helper.GetObjectTypeNumericID("Page") && !string.IsNullOrEmpty(Request.QueryString["OT"]))
            {
                if (this._Host.ParentPageType == PageType.Overview)
                {
                    quickParametersTag.RelatedObjectType = Helper.GetObjectTypeNumericID(Request.QueryString["OT"]);

                    if (!string.IsNullOrEmpty(Request.QueryString["XUI"]))
                    {
                        quickParametersTag.RelatedUserID = Request.QueryString["XUI"].ToGuid();
                    }

                    if (!string.IsNullOrEmpty(Request.QueryString["XCN"]))
                    {
                        quickParametersTag.RelatedCommunityID = Request.QueryString["XCN"].ToGuid();
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }

            List <TagCloudItem> relatedTags = DataObjectTag.GetTagCloud(5, quickParametersTag);

            if (relatedTags.Count > 0)
            {
                hasContent = true;

                HtmlGenericControl div;
                HyperLink          link;

                foreach (TagCloudItem tagWord in relatedTags)
                {
                    div              = new HtmlGenericControl("div");
                    link             = new HyperLink();
                    link.Text        = tagWord.Tag.Title;
                    link.NavigateUrl = string.Format("{0}?TGL1={1}{2}", Request.CurrentExecutionFilePath, tagWord.Tag.Title, queryStringWithoutTag);
                    if (!string.IsNullOrEmpty(Request.QueryString["TGL1"]) && Request.QueryString["TGL1"] == tagWord.Tag.Title)
                    {
                        link.CssClass = "CSB_admin_menu_i";
                    }
                    else
                    {
                        link.CssClass = "CSB_admin_menu_a";
                    }

                    div.Controls.Add(link);
                    Ph.Controls.Add(div);
                }

                if (!string.IsNullOrEmpty(Request.QueryString["TGL1"]))
                {
                    div              = new HtmlGenericControl("div");
                    link             = new HyperLink();
                    link.Text        = GuiLanguage.GetGuiLanguage("WidgetFunctionsFilter").GetString("CommandFilterReset");
                    link.NavigateUrl = string.Format("{0}?{1}", Request.CurrentExecutionFilePath, queryStringWithoutTag.TrimStart('&'));
                    link.CssClass    = "CSB_admin_menu_a";

                    div.Controls.Add(link);
                    Ph.Controls.Add(div);
                }
            }
        }
        private void SetAutoTagFilter(int amount, int relvance)
        {
            QuickTagCloudRelevanceGroup enuRepevance = (QuickTagCloudRelevanceGroup)relvance;
            int groupAmount = 24;

            if (relvance > 0)
            {
                if (relvance <= 3)
                {
                    groupAmount = 60;
                }
                else if (relvance <= 5)
                {
                    groupAmount = 24;
                }
                else
                {
                    groupAmount = 16;
                }
            }

            QuickParametersTag quickParametersTag = new QuickParametersTag();

            quickParametersTag.Udc                  = UserDataContext.GetUserDataContext();
            quickParametersTag.IgnoreCache          = false;
            quickParametersTag.Amount               = amount;
            quickParametersTag.RelevanceGroup       = enuRepevance;
            quickParametersTag.RelevanceGroupAmount = groupAmount;
            quickParametersTag.Relevance            = QuickTagCloudRelevance.ObjectView;

            if (this.WidgetHost.ParentObjectType == Helper.GetObjectTypeNumericID("ProfileCommunity"))
            {
                DataObject profileCommunity = DataObject.Load <DataObject>(this.WidgetHost.ParentCommunityID);
                quickParametersTag.RelatedUserID = profileCommunity.UserID.Value;
            }
            else if (this.WidgetHost.ParentObjectType == Helper.GetObjectTypeNumericID("Community"))
            {
                quickParametersTag.RelatedCommunityID = WidgetHost.ParentCommunityID;
            }
            if (this.WidgetHost.ParentObjectType == Helper.GetObjectTypeNumericID("Page") && !string.IsNullOrEmpty(Request.QueryString["OT"]))
            {
                if (this.WidgetHost.ParentPageType == PageType.Overview)
                {
                    quickParametersTag.RelatedObjectType = Helper.GetObjectTypeNumericID(Request.QueryString["OT"]);

                    if (!string.IsNullOrEmpty(Request.QueryString["XUI"]))
                    {
                        quickParametersTag.RelatedUserID = Request.QueryString["XUI"].ToGuid();
                    }

                    if (!string.IsNullOrEmpty(Request.QueryString["XCN"]))
                    {
                        quickParametersTag.RelatedCommunityID = Request.QueryString["XCN"].ToGuid();
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                return;
            }

            List <TagCloudItem> relatedTags = DataObjectTag.GetTagCloud(5, quickParametersTag);

            if (relatedTags.Count > 0)
            {
                hasContent = true;

                HtmlGenericControl li;
                HyperLink          link;

                foreach (TagCloudItem tagWord in relatedTags)
                {
                    li = new HtmlGenericControl("li");
                    string tagClass = "tagClass" + tagWord.TagClass;
                    link             = new HyperLink();
                    link.Text        = Helper.GetMappedTagWord(tagWord.Tag.Title);
                    link.NavigateUrl = string.Format("{0}?TGL1={1}{2}", Request.GetRawPath(), tagWord.Tag.Title, queryStringWithoutTag);
                    if (!string.IsNullOrEmpty(Request.QueryString["TGL1"]) && Request.QueryString["TGL1"] == tagWord.Tag.Title)
                    {
                        tagClass += " tagActive";
                    }
                    li.Attributes.Add("class", tagClass);
                    li.Controls.Add(link);
                    Ph.Controls.Add(li);
                }

                RenderResetLink();
            }
        }