public string Render()
        {
            StringBuilder sb = new StringBuilder();

            Data.CommonDB db    = new Data.CommonDB();
            string        sHost = Utilities.GetHost();

            if (sHost.EndsWith("/"))
            {
                sHost = sHost.Substring(0, sHost.Length - 1);
            }
            ControlUtils ctlUtils    = new ControlUtils();
            string       forumPrefix = string.Empty;
            string       groupPrefix = string.Empty;

            //Dim _forumGroupId As Integer = -1
            if (ParentForumId == -1)
            {
                ParentForumId = ForumId;
            }
            string groupTemplate    = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUMGROUP]", "[/AF:DIR:FORUMGROUP]");
            string forumTemplate    = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUM]", "[/AF:DIR:FORUM]");
            string subForumTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:SUBFORUM]", "[/AF:DIR:SUBFORUM]");
            bool   useFriendlyUrl   = Utilities.IsRewriteLoaded();
            int    currGroup        = -1;
            string gtmp             = string.Empty;
            string ftmp             = string.Empty;
            string subtmp           = string.Empty;

            using (IDataReader dr = db.ForumContent_List(PortalId, ModuleId, ForumGroupId, ForumId, ParentForumId))
            {
                //ParentForum Section
                dr.Read();
                //SubForums
                dr.NextResult();
                dr.Read();
                //Topics in ParentForum
                dr.NextResult();
                string catKey   = string.Empty;
                int    count    = 0;
                int    catCount = 0;
                sb.Append("<ul>");
                while (dr.Read())
                {
                    if (catKey != dr["CategoryName"].ToString() + dr["CategoryId"].ToString())
                    {
                        if (count > 0)
                        {
                            sb.Replace("[CATCOUNT]", catCount.ToString());
                            sb.Append("</ul></li>");
                            count    = 0;
                            catCount = 0;
                        }

                        sb.Append("<li class=\"category\" id=\"afcat-" + dr["CategoryId"].ToString() + "\">");


                        sb.Append("<em>[CATCOUNT]</em>");
                        sb.Append("<span>" + dr["CategoryName"].ToString() + "</span>");
                        sb.Append("<ul>");

                        catKey = dr["CategoryName"].ToString() + dr["CategoryId"].ToString();
                    }
                    //Dim Params As String() = {"aff=" & ForumId, "fcc=" & dr("TopicId").ToString}
                    if (TopicId == Convert.ToInt32(dr["TopicId"].ToString()))
                    {
                        sb.Append("<li class=\"fcv-selected\">");
                        sb.Replace("<li class=\"category\" id=\"afcat-" + dr["CategoryId"].ToString() + "\">", "<li class=\"category cat-selected\" id=\"afcat-" + dr["CategoryId"].ToString() + "\">");
                    }
                    else
                    {
                        sb.Append("<li>");
                    }
                    catCount += 1;
                    //Dim Params As String() = {ParamKeys.ForumId & "=" & ForumId, ParamKeys.TopicId & "=" & TopicId, ParamKeys.ViewType & "=topic"}
                    string[] Params = { ParamKeys.TopicId + "=" + dr["TopicId"].ToString() };
                    //Dim sTopicURL As String = ctlUtils.BuildUrl(TabId, ModuleId, groupPrefix, forumPrefix, ForumGroupId, ForumId, Integer.Parse(dr("TopicId").ToString), dr("URL").ToString, -1, -1, String.Empty, 1)
                    string sTopicURL = ctlUtils.TopicURL(dr, TabId, ModuleId);
                    sb.Append("<a href=\"" + sTopicURL + "\"><span>" + dr["Subject"].ToString() + "</span></a></li>");
                    if (TopicId > 0)
                    {
                        if (Convert.ToInt32(dr["TopicId"].ToString()) == TopicId)
                        {
                            //  RenderTopic(dr)
                        }
                    }

                    count += 1;
                }
                sb.Replace("[CATCOUNT]", catCount.ToString());
                if (count > 0)
                {
                    sb.Append("</ul></li>");
                }
                sb.Append("</ul>");
                dr.Close();
            }
            return(sb.ToString());
        }
Пример #2
0
        public string Render()
        {
            StringBuilder sb = new StringBuilder();

            Data.CommonDB db    = new Data.CommonDB();
            string        sHost = Utilities.GetHost();

            if (sHost.EndsWith("/"))
            {
                sHost = sHost.Substring(0, sHost.Length - 1);
            }
            ControlUtils ctlUtils    = new ControlUtils();
            string       forumPrefix = string.Empty;
            string       groupPrefix = string.Empty;

            //Dim _forumGroupId As Integer = -1
            if (ParentForumId == -1)
            {
                ParentForumId = ForumId;
            }
            string groupTemplate    = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUMGROUP]", "[/AF:DIR:FORUMGROUP]");
            string forumTemplate    = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUM]", "[/AF:DIR:FORUM]");
            string subForumTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:SUBFORUM]", "[/AF:DIR:SUBFORUM]");
            bool   useFriendlyUrl   = Utilities.IsRewriteLoaded();
            int    currGroup        = -1;
            string gtmp             = string.Empty;
            string ftmp             = string.Empty;
            string subtmp           = string.Empty;

            using (IDataReader dr = db.ForumContent_List(PortalId, ModuleId, ForumGroupId, ForumId, ParentForumId))
            {
                //ParentForum Section
                while (dr.Read())
                {
                    string sURL = ctlUtils.BuildUrl(TabId, ModuleId, dr["GroupPrefixURL"].ToString(), dr["PrefixURL"].ToString(), int.Parse(dr["ForumGroupId"].ToString()), int.Parse(dr["ForumId"].ToString()), -1, -1, string.Empty, 1, -1, -1);
                    if (IncludeClasses)
                    {
                        sb.Append("<div class=\"fcv-header\"><a href=\"" + sURL + "\"><span>" + dr["ForumName"].ToString() + "</span></a></div>");
                    }
                    else
                    {
                        sb.Append("<div><a href=\"" + sURL + "\"><span>" + dr["ForumName"].ToString() + "</span></a></div>");
                    }

                    forumPrefix = dr["PrefixURL"].ToString();
                    groupPrefix = dr["GroupPrefixURL"].ToString();
                    //  _forumGroupId = Integer.Parse(dr("ForumGroupId").ToString)
                }
                //SubForums
                dr.NextResult();
                int    subForumCount = 0;
                string sSubforums    = string.Empty;
                while (dr.Read())
                {
                    if (Permissions.HasPerm(dr["CanRead"].ToString(), ForumUser.UserRoles))
                    {
                        string sURL = ctlUtils.BuildUrl(TabId, ModuleId, dr["GroupPrefixURL"].ToString(), dr["PrefixURL"].ToString(), int.Parse(dr["ForumGroupId"].ToString()), int.Parse(dr["ForumId"].ToString()), -1, -1, string.Empty, 1, -1, -1);
                        if (ForumId == int.Parse(dr["ForumId"].ToString()))
                        {
                            sSubforums += "<li class=\"fcv-selected\">";
                        }
                        else
                        {
                            sSubforums += "<li>";
                        }

                        sSubforums += "<a href=\"" + sURL + "\"><em></em><span>" + dr["ForumName"].ToString() + "</span></a></li>";
                        if (IncludeClasses)
                        {
                            sSubforums += "<li class=\"fcv-desc\">" + dr["ForumDesc"].ToString() + "</li>";
                        }
                        else
                        {
                            sSubforums += "<li>" + dr["ForumDesc"].ToString() + "</li>";
                        }
                    }
                }
                if (!(string.IsNullOrEmpty(sSubforums)))
                {
                    if (IncludeClasses)
                    {
                        sb.Append("<ul class=\"fcv-subforums\">");
                    }
                    else
                    {
                        sb.Append("<ul>");
                    }

                    sb.Append(sSubforums);
                    sb.Append("</ul>");
                }
                //Topics in ParentForum
                dr.NextResult();
                string catKey   = string.Empty;
                int    count    = 0;
                int    catCount = 0;
                while (dr.Read())
                {
                    if (catKey != dr["CategoryName"].ToString() + dr["CategoryId"].ToString())
                    {
                        if (count > 0)
                        {
                            sb.Replace("[CATCOUNT]", catCount.ToString());
                            sb.Append("</ul></div>");
                            count    = 0;
                            catCount = 0;
                        }
                        if (IncludeClasses)
                        {
                            sb.Append("<div class=\"fcv-categorysection\"><div class=\"fcv-categoryname\"><span class=\"fcv-catcount\">[CATCOUNT]</span>" + dr["CategoryName"].ToString() + " </div>");
                            sb.Append("<ul class=\"fcv-topicslist\">");
                        }
                        else
                        {
                            sb.Append("<div><div><span>[CATCOUNT]</span>" + dr["CategoryName"].ToString() + " </div>");
                            sb.Append("<ul>");
                        }

                        catKey = dr["CategoryName"].ToString() + dr["CategoryId"].ToString();
                    }
                    //Dim Params As String() = {"aff=" & ForumId, "fcc=" & dr("TopicId").ToString}
                    if (TopicId == Convert.ToInt32(dr["TopicId"].ToString()))
                    {
                        sb.Append("<li class=\"fcv-selected\">");
                    }
                    else
                    {
                        sb.Append("<li>");
                    }
                    catCount += 1;
                    //Dim Params As String() = {ParamKeys.ForumId & "=" & ForumId, ParamKeys.TopicId & "=" & TopicId, ParamKeys.ViewType & "=topic"}
                    string[] Params    = { ParamKeys.TopicId + "=" + dr["TopicId"].ToString() };
                    string   sTopicURL = ctlUtils.BuildUrl(TabId, ModuleId, groupPrefix, forumPrefix, ForumGroupId, ForumId, int.Parse(dr["TopicId"].ToString()), dr["URL"].ToString(), -1, -1, string.Empty, 1, -1, -1);
                    sb.Append("<a href=\"" + sTopicURL + "\"><span>" + dr["Subject"].ToString() + "</span></a></li>");
                    if (TopicId > 0)
                    {
                        if (Convert.ToInt32(dr["TopicId"].ToString()) == TopicId)
                        {
                            //  RenderTopic(dr)
                        }
                    }

                    count += 1;
                }
                sb.Replace("[CATCOUNT]", catCount.ToString());
                if (count > 0)
                {
                    sb.Append("</ul></div>");
                }
                dr.Close();
            }
            return(sb.ToString());
        }
Пример #3
0
        public string Render()
        {
            StringBuilder sb = new StringBuilder();
            Data.CommonDB db = new Data.CommonDB();
            string sHost = Utilities.GetHost();
            if (sHost.EndsWith("/"))
            {
                sHost = sHost.Substring(0, sHost.Length - 1);
            }
            ControlUtils ctlUtils = new ControlUtils();
            string forumPrefix = string.Empty;
            string groupPrefix = string.Empty;
            //Dim _forumGroupId As Integer = -1
            if (ParentForumId == -1)
            {
                ParentForumId = ForumId;
            }
            string groupTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUMGROUP]", "[/AF:DIR:FORUMGROUP]");
            string forumTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUM]", "[/AF:DIR:FORUM]");
            string subForumTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:SUBFORUM]", "[/AF:DIR:SUBFORUM]");
            bool useFriendlyUrl = Utilities.IsRewriteLoaded();
            int currGroup = -1;
            string gtmp = string.Empty;
            string ftmp = string.Empty;
            string subtmp = string.Empty;
            using (IDataReader dr = db.ForumContent_List(PortalId, ModuleId, ForumGroupId, ForumId, ParentForumId))
            {
                //ParentForum Section
                while (dr.Read())
                {
                    string sURL = ctlUtils.BuildUrl(TabId, ModuleId, dr["GroupPrefixURL"].ToString(), dr["PrefixURL"].ToString(), int.Parse(dr["ForumGroupId"].ToString()), int.Parse(dr["ForumId"].ToString()), -1, -1, string.Empty, 1, -1);
                    if (IncludeClasses)
                    {
                        sb.Append("<div class=\"fcv-header\"><a href=\"" + sURL + "\"><span>" + dr["ForumName"].ToString() + "</span></a></div>");
                    }
                    else
                    {
                        sb.Append("<div><a href=\"" + sURL + "\"><span>" + dr["ForumName"].ToString() + "</span></a></div>");
                    }

                    forumPrefix = dr["PrefixURL"].ToString();
                    groupPrefix = dr["GroupPrefixURL"].ToString();
                    //  _forumGroupId = Integer.Parse(dr("ForumGroupId").ToString)
                }
                //SubForums
                dr.NextResult();
                int subForumCount = 0;
                string sSubforums = string.Empty;
                while (dr.Read())
                {
                    if (Permissions.HasPerm(dr["CanRead"].ToString(), ForumUser.UserRoles))
                    {
                        string sURL = ctlUtils.BuildUrl(TabId, ModuleId, dr["GroupPrefixURL"].ToString(), dr["PrefixURL"].ToString(), int.Parse(dr["ForumGroupId"].ToString()), int.Parse(dr["ForumId"].ToString()), -1, -1, string.Empty, 1, -1);
                        if (ForumId == int.Parse(dr["ForumId"].ToString()))
                        {
                            sSubforums += "<li class=\"fcv-selected\">";
                        }
                        else
                        {
                            sSubforums += "<li>";
                        }

                        sSubforums += "<a href=\"" + sURL + "\"><em></em><span>" + dr["ForumName"].ToString() + "</span></a></li>";
                        if (IncludeClasses)
                        {
                            sSubforums += "<li class=\"fcv-desc\">" + dr["ForumDesc"].ToString() + "</li>";
                        }
                        else
                        {
                            sSubforums += "<li>" + dr["ForumDesc"].ToString() + "</li>";
                        }

                    }

                }
                if (! (string.IsNullOrEmpty(sSubforums)))
                {
                    if (IncludeClasses)
                    {
                        sb.Append("<ul class=\"fcv-subforums\">");
                    }
                    else
                    {
                        sb.Append("<ul>");
                    }

                    sb.Append(sSubforums);
                    sb.Append("</ul>");
                }
                //Topics in ParentForum
                dr.NextResult();
                string catKey = string.Empty;
                int count = 0;
                int catCount = 0;
                while (dr.Read())
                {
                    if (catKey != dr["CategoryName"].ToString() + dr["CategoryId"].ToString())
                    {
                        if (count > 0)
                        {
                            sb.Replace("[CATCOUNT]", catCount.ToString());
                            sb.Append("</ul></div>");
                            count = 0;
                            catCount = 0;
                        }
                        if (IncludeClasses)
                        {
                            sb.Append("<div class=\"fcv-categorysection\"><div class=\"fcv-categoryname\"><span class=\"fcv-catcount\">[CATCOUNT]</span>" + dr["CategoryName"].ToString() + " </div>");
                            sb.Append("<ul class=\"fcv-topicslist\">");
                        }
                        else
                        {
                            sb.Append("<div><div><span>[CATCOUNT]</span>" + dr["CategoryName"].ToString() + " </div>");
                            sb.Append("<ul>");
                        }

                        catKey = dr["CategoryName"].ToString() + dr["CategoryId"].ToString();
                    }
                    //Dim Params As String() = {"aff=" & ForumId, "fcc=" & dr("TopicId").ToString}
                    if (TopicId == Convert.ToInt32(dr["TopicId"].ToString()))
                    {
                        sb.Append("<li class=\"fcv-selected\">");
                    }
                    else
                    {
                        sb.Append("<li>");
                    }
                    catCount += 1;
                    //Dim Params As String() = {ParamKeys.ForumId & "=" & ForumId, ParamKeys.TopicId & "=" & TopicId, ParamKeys.ViewType & "=topic"}
                    string[] Params = {ParamKeys.TopicId + "=" + dr["TopicId"].ToString()};
                    string sTopicURL = ctlUtils.BuildUrl(TabId, ModuleId, groupPrefix, forumPrefix, ForumGroupId, ForumId, int.Parse(dr["TopicId"].ToString()), dr["URL"].ToString(), -1, -1, string.Empty, 1, -1);
                    sb.Append("<a href=\"" + sTopicURL + "\"><span>" + dr["Subject"].ToString() + "</span></a></li>");
                    if (TopicId > 0)
                    {
                        if (Convert.ToInt32(dr["TopicId"].ToString()) == TopicId)
                        {
                            //  RenderTopic(dr)
                        }
                    }

                    count += 1;
                }
                sb.Replace("[CATCOUNT]", catCount.ToString());
                if (count > 0)
                {
                    sb.Append("</ul></div>");
                }
                dr.Close();
            }
            return sb.ToString();
        }
Пример #4
0
		public string Render()
		{
			StringBuilder sb = new StringBuilder();
			Data.CommonDB db = new Data.CommonDB();
			string sHost = Utilities.GetHost();
			if (sHost.EndsWith("/"))
			{
				sHost = sHost.Substring(0, sHost.Length - 1);
			}
			ControlUtils ctlUtils = new ControlUtils();
			string forumPrefix = string.Empty;
			string groupPrefix = string.Empty;
			//Dim _forumGroupId As Integer = -1
			if (ParentForumId == -1)
			{
				ParentForumId = ForumId;
			}
			string groupTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUMGROUP]", "[/AF:DIR:FORUMGROUP]");
			string forumTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:FORUM]", "[/AF:DIR:FORUM]");
			string subForumTemplate = TemplateUtils.GetTemplateSection(ItemTemplate, "[AF:DIR:SUBFORUM]", "[/AF:DIR:SUBFORUM]");
			bool useFriendlyUrl = Utilities.IsRewriteLoaded();
			int currGroup = -1;
			string gtmp = string.Empty;
			string ftmp = string.Empty;
			string subtmp = string.Empty;
			using (IDataReader dr = db.ForumContent_List(PortalId, ModuleId, ForumGroupId, ForumId, ParentForumId))
			{
				//ParentForum Section
				dr.Read();
				//SubForums
				dr.NextResult();
				dr.Read();
				//Topics in ParentForum
				dr.NextResult();
				string catKey = string.Empty;
				int count = 0;
				int catCount = 0;
				sb.Append("<ul>");
				while (dr.Read())
				{
					if (catKey != dr["CategoryName"].ToString() + dr["CategoryId"].ToString())
					{
						if (count > 0)
						{
							sb.Replace("[CATCOUNT]", catCount.ToString());
							sb.Append("</ul></li>");
							count = 0;
							catCount = 0;
						}

						sb.Append("<li class=\"category\" id=\"afcat-" + dr["CategoryId"].ToString() + "\">");


						sb.Append("<em>[CATCOUNT]</em>");
						sb.Append("<span>" + dr["CategoryName"].ToString() + "</span>");
						sb.Append("<ul>");

						catKey = dr["CategoryName"].ToString() + dr["CategoryId"].ToString();
					}
					//Dim Params As String() = {"aff=" & ForumId, "fcc=" & dr("TopicId").ToString}
					if (TopicId == Convert.ToInt32(dr["TopicId"].ToString()))
					{
						sb.Append("<li class=\"fcv-selected\">");
						sb.Replace("<li class=\"category\" id=\"afcat-" + dr["CategoryId"].ToString() + "\">", "<li class=\"category cat-selected\" id=\"afcat-" + dr["CategoryId"].ToString() + "\">");
					}
					else
					{
						sb.Append("<li>");
					}
					catCount += 1;
					//Dim Params As String() = {ParamKeys.ForumId & "=" & ForumId, ParamKeys.TopicId & "=" & TopicId, ParamKeys.ViewType & "=topic"}
					string[] Params = {ParamKeys.TopicId + "=" + dr["TopicId"].ToString()};
					//Dim sTopicURL As String = ctlUtils.BuildUrl(TabId, ModuleId, groupPrefix, forumPrefix, ForumGroupId, ForumId, Integer.Parse(dr("TopicId").ToString), dr("URL").ToString, -1, -1, String.Empty, 1)
					string sTopicURL = ctlUtils.TopicURL(dr, TabId, ModuleId);
					sb.Append("<a href=\"" + sTopicURL + "\"><span>" + dr["Subject"].ToString() + "</span></a></li>");
					if (TopicId > 0)
					{
						if (Convert.ToInt32(dr["TopicId"].ToString()) == TopicId)
						{
							//  RenderTopic(dr)
						}
					}

					count += 1;
				}
				sb.Replace("[CATCOUNT]", catCount.ToString());
				if (count > 0)
				{
					sb.Append("</ul></li>");
				}
				sb.Append("</ul>");
				dr.Close();
			}
			return sb.ToString();
		}