예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ForumContainer.Options.InfoType = InfoType.Alert;

            StringBuilder sb = new StringBuilder();
            sb.Append("<script language=\"javascript\"  type=\"text/javascript\"> ForumMakerProvider.All='" + Resources.ForumResource.All + "'; ");
            sb.Append(" ForumMakerProvider.ConfirmMessage='" + Resources.ForumResource.ConfirmMessage + "'; ");
            sb.Append(" ForumMakerProvider.SaveButton='" + Resources.ForumResource.SaveButton + "'; ");
            sb.Append(" ForumMakerProvider.CancelButton='" + Resources.ForumResource.CancelButton + "'; ");
            sb.Append(" ForumMakerProvider.NameEmptyString='" + Resources.ForumResource.NameEmptyString + "'; ");
            sb.Append(" ForumContainer_PanelInfoID = '" + ForumContainer.GetInfoPanelClientID() + "'; ");

            sb.Append("</script>");

            this.Page.ClientScript.RegisterClientScriptInclude(typeof(string), "forummaker_script", WebPath.GetPath(ForumManager.BaseVirtualPath.Substring(2) + "/js/forummaker.js"));
            this.Page.ClientScript.RegisterClientScriptBlock(typeof(string), "forummaker_script_init", sb.ToString(), false);

            SearchText = "";

            if (!String.IsNullOrEmpty(Request["search"]))
                SearchText = Request["search"];

            var tags = ForumDataProvider.GetTagCloud(TenantProvider.CurrentTenantID, 40);
            TabCloudContainer.Title = Resources.ForumResource.TagCloud;
            TabCloudContainer.HeaderCSSClass = "studioSideBoxTagCloudHeader";
            TabCloudContainer.ImageURL = WebImageSupplier.GetAbsoluteWebPath("tagcloud.png");

            foreach (RankTag tag in tags)
            {
                TagCloudItem item = new TagCloudItem();
                item.TagName = tag.Name;
                item.TagID = tag.ID.ToString();
                item.Rank = tag.Rank;
                item.URL = "search.aspx?tag=" + tag.ID;
                tagCloud.Items.Add(item);
            }
            if (tags.Count == 0)
                TabCloudContainer.Visible = false;

            sideRecentActivity.TenantId = TenantProvider.CurrentTenantID;
            sideRecentActivity.ProductId = Product.CommunityProduct.ID;
            sideRecentActivity.ModuleId = Forum.ForumManager.ModuleID;


            string script = "<link href=\"" + WebSkin.GetUserSkin().GetAbsoluteWebPath(ForumManager.BaseVirtualPath.Substring(2) + "/app_themes/<theme_folder>/style.css") + "\" rel=\"stylesheet\" type=\"text/css\" />";
            this.Page.ClientScript.RegisterClientScriptBlock(typeof(string), Guid.NewGuid().ToString(), script);

            SetNavigation();
        }
        private static TagCloud GetTagsCloud(IList<Tag> tagsCloud)
        {
            TagCloud tagCloud = new TagCloud();

            var ServiceHelper = BookmarkingServiceHelper.GetCurrentInstanse();

            var tags = tagsCloud;
            foreach (var tag in tags)
            {
                TagCloudItem item = new TagCloudItem();
                item.TagName = tag.Name;
                item.Rank = tag.Populatiry;
                item.URL = ServiceHelper.GetSearchByTagUrl(tag);

                tagCloud.Items.Add(item);
            }

            return tagCloud;
        }