/// <summary> /// Copies the elements of the specified <see cref="IndexPageForumInfo">IndexPageForumInfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="IndexPageForumInfo">IndexPageForumInfo</see> containing the Components to add to the collection.</param> public void AddRange(IndexPageForumInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(IndexPageForumInfo[] array, int index) { this.List.CopyTo(array, index); }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(IndexPageForumInfo value) { return this.List.Contains(value); }
/// <summary> /// Initializes a new instance of the <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see> class containing the specified array of <see cref="IndexPageForumInfo">IndexPageForumInfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="IndexPageForumInfo">IndexPageForumInfo</see> Components with which to initialize the collection. </param> public IndexPageForumInfoCollection(IndexPageForumInfo[] value) { this.AddRange(value); }
public int Add(IndexPageForumInfo value) { return this.List.Add(value); }
/// <summary> /// 获取版主信息 /// </summary> /// <param name="info">版块信息</param> /// <param name="moderStyle">版主显示样式,0为横排,1为下拉</param> /// <returns></returns> private static string GetModerators(IndexPageForumInfo info, int moderStyle) { StringBuilder sb = new StringBuilder(); StringBuilder subModeratorsBuilder = new StringBuilder(); //如果当前用户权限不够 if (sb.Length > 0) sb.Remove(0, sb.Length); int mainModerCount = info.Layer <= 0 ? 3 : 6; int count = 0; foreach (string moderators in Utils.SplitString(info.Moderators, ",")) { if (!Utils.StrIsNullOrEmpty(moderators.Trim())) { if (moderStyle == 0) { string link = string.Format("<a href=\"{0}userinfo.aspx?username={1}\" target=\"_blank\">{2}</a>,", BaseConfigs.GetForumPath, Utils.UrlEncode(moderators.Trim()), moderators.Trim()); //如果主版主列表个数已经超过限定值,则将版主加入到子列表中 if (count++ < mainModerCount) sb.Append(link); else subModeratorsBuilder.AppendFormat("<li>{0}</li>", link.TrimEnd(',')); } else sb.AppendFormat("<option value=\"{0}\">{1}</option>", moderators.Trim(), moderators.Trim()); } } if (!Utils.StrIsNullOrEmpty(sb.ToString()) && moderStyle == 1) { sb.Insert(0, string.Format("<select style=\"width: 100px;\" onchange=\"window.open('{0}userinfo.aspx?username='******'ctrlid':this.id, 'pos':'21'}})\">......</a><ul id=\"forum{0}_submoderators_menu\" class=\"p_pop moders\" style=\"position: absolute; z-index: 301; left: 998.5px; top: 93px; display: none;\">", info.Fid)); subModeratorsBuilder.Append("</ul>"); sb.Append(subModeratorsBuilder); } return sb.ToString().TrimEnd(','); }
public void Remove(IndexPageForumInfo value) { List.Remove(value); }
public static List<IndexPageForumInfo> GetSubForumList(int fid, int colcount) { IDataReader reader = DatabaseProvider.GetInstance().GetSubForumReader(fid); List<IndexPageForumInfo> indexPageForumList = new List<IndexPageForumInfo>(); if (reader != null) { while (reader.Read()) { IndexPageForumInfo info = new IndexPageForumInfo(); //赋值 info.Fid = TypeConverter.StrToInt(reader["fid"].ToString(), 0); info.Parentid = TypeConverter.StrToInt(reader["parentid"].ToString(), 0); info.Layer = TypeConverter.StrToInt(reader["layer"].ToString(), 0); info.Name = reader["name"].ToString(); info.Pathlist = reader["pathlist"].ToString(); info.Parentidlist = reader["parentidlist"].ToString(); info.Subforumcount = TypeConverter.StrToInt(reader["subforumcount"].ToString(), 0); info.Status = TypeConverter.StrToInt(reader["status"].ToString(), 0); info.Colcount = colcount > 0 ? colcount : TypeConverter.StrToInt(reader["colcount"].ToString(), 0); info.Displayorder = TypeConverter.StrToInt(reader["displayorder"].ToString(), 0); info.Templateid = TypeConverter.StrToInt(reader["templateid"].ToString(), 0); info.Topics = TypeConverter.StrToInt(reader["topics"].ToString(), 0); info.CurrentTopics = TypeConverter.StrToInt(reader["curtopics"].ToString(), 0); info.Posts = TypeConverter.StrToInt(reader["posts"].ToString(), 0); info.Todayposts = TypeConverter.StrToInt(reader["todayposts"].ToString(), 0); info.Lastpost = reader["lastpost"].ToString(); info.Lastposter = reader["lastposter"].ToString(); info.Lasttid = TypeConverter.StrToInt(reader["lasttid"].ToString(), 0); info.Lastposterid = TypeConverter.StrToInt(reader["lastposterid"].ToString(), 0); info.Lasttitle = reader["lasttitle"].ToString(); info.Allowsmilies = TypeConverter.StrToInt(reader["allowsmilies"].ToString(), 0); info.Allowrss = TypeConverter.StrToInt(reader["allowrss"].ToString(), 0); info.Allowhtml = TypeConverter.StrToInt(reader["allowhtml"].ToString(), 0); info.Allowbbcode = TypeConverter.StrToInt(reader["allowbbcode"].ToString(), 0); info.Allowimgcode = TypeConverter.StrToInt(reader["allowimgcode"].ToString(), 0); info.Allowblog = TypeConverter.StrToInt(reader["allowblog"].ToString(), 0); info.Istrade = TypeConverter.StrToInt(reader["istrade"].ToString(), 0); info.Allowpostspecial = TypeConverter.StrToInt(reader["allowpostspecial"].ToString(), 0); info.Allowspecialonly = TypeConverter.StrToInt(reader["allowspecialonly"].ToString(), 0); info.Alloweditrules = TypeConverter.StrToInt(reader["alloweditrules"].ToString(), 0); info.Allowthumbnail = TypeConverter.StrToInt(reader["allowthumbnail"].ToString(), 0); info.Recyclebin = TypeConverter.StrToInt(reader["recyclebin"].ToString(), 0); info.Modnewposts = TypeConverter.StrToInt(reader["modnewposts"].ToString(), 0); info.Jammer = TypeConverter.StrToInt(reader["jammer"].ToString(), 0); info.Disablewatermark = TypeConverter.StrToInt(reader["disablewatermark"].ToString(), 0); info.Inheritedmod = TypeConverter.StrToInt(reader["inheritedmod"].ToString(), 0); info.Autoclose = TypeConverter.StrToInt(reader["autoclose"].ToString(), 0); info.Description = reader["description"].ToString(); info.Password = reader["password"].ToString(); info.Icon = reader["icon"].ToString(); if (!Utils.StrIsNullOrEmpty(info.Icon)) info.Icon = info.Icon.ToLower().IndexOf("http://") == 0 ? info.Icon : BaseConfigs.GetForumPath + info.Icon; info.Postcredits = reader["postcredits"].ToString(); info.Replycredits = reader["replycredits"].ToString(); info.Redirect = reader["redirect"].ToString(); info.Attachextensions = reader["attachextensions"].ToString(); info.Moderators = reader["moderators"].ToString(); info.Rules = reader["rules"].ToString(); info.Topictypes = reader["topictypes"].ToString(); info.Viewperm = reader["viewperm"].ToString(); info.Postperm = reader["postperm"].ToString(); info.Replyperm = reader["replyperm"].ToString(); info.Getattachperm = reader["getattachperm"].ToString(); info.Postattachperm = reader["postattachperm"].ToString(); info.Applytopictype = TypeConverter.StrToInt(reader["applytopictype"].ToString(), 0); info.Postbytopictype = TypeConverter.StrToInt(reader["postbytopictype"].ToString(), 0); info.Viewbytopictype = TypeConverter.StrToInt(reader["viewbytopictype"].ToString(), 0); info.Topictypeprefix = TypeConverter.StrToInt(reader["topictypeprefix"].ToString(), 0); info.Permuserlist = reader["permuserlist"].ToString(); info.Seokeywords = reader["seokeywords"].ToString(); info.Seodescription = reader["seodescription"].ToString(); info.Rewritename = reader["rewritename"].ToString(); //扩展属性 info.Havenew = reader["havenew"].ToString(); indexPageForumList.Add(info); } reader.Close(); } return indexPageForumList; }
/// <summary> /// Gets the index in the collection of the specified <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(IndexPageForumInfo value) { return this.List.IndexOf(value); }
public int Add(IndexPageForumInfo value) { return(this.List.Add(value)); }
/// <summary> /// Gets a value indicating whether the collection contains the specified <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(IndexPageForumInfo value) { return(this.List.Contains(value)); }
public void Remove(IndexPageForumInfo value) { List.Remove(value); }
public void Insert(int index, IndexPageForumInfo value) { List.Insert(index, value); }
/// <summary> /// Gets the index in the collection of the specified <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="IndexPageForumInfoCollection">IndexPageForumInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(IndexPageForumInfo value) { return(this.List.IndexOf(value)); }
public static Discuz.Common.Generic.List<IndexPageForumInfo> GetSubForumCollection(int fid, int colcount, int hideprivate, int usergroupid, int moderstyle) { Discuz.Common.Generic.List<IndexPageForumInfo> coll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); #endif if (fid <= 0) { return coll; } IDataReader reader = DatabaseProvider.GetInstance().GetSubForumReader(fid); if (reader != null) { while (reader.Read()) { IndexPageForumInfo info = new IndexPageForumInfo(); //赋值 info.Fid = Int32.Parse(reader["fid"].ToString()); info.Parentid = Int16.Parse(reader["parentid"].ToString()); info.Layer = Int16.Parse(reader["layer"].ToString()); info.Name = reader["name"].ToString(); info.Pathlist = reader["pathlist"].ToString(); info.Parentidlist = reader["parentidlist"].ToString(); info.Subforumcount = Int32.Parse(reader["subforumcount"].ToString()); info.Status = Int32.Parse(reader["status"].ToString()); if (colcount > 0) { info.Colcount = colcount; } else { info.Colcount = Int16.Parse(reader["colcount"].ToString()); } info.Displayorder = Int32.Parse(reader["displayorder"].ToString()); info.Templateid = Int16.Parse(reader["templateid"].ToString()); info.Topics = Int32.Parse(reader["topics"].ToString()); info.CurrentTopics = Int32.Parse(reader["curtopics"].ToString()); info.Posts = Int32.Parse(reader["posts"].ToString()); info.Todayposts = Int32.Parse(reader["todayposts"].ToString()); info.Lastpost = reader["lastpost"].ToString(); info.Lastposter = reader["lastposter"].ToString(); info.Lasttid = Int32.Parse(reader["lasttid"].ToString()); info.Lastposterid = Int32.Parse(reader["lastposterid"].ToString()); info.Lasttitle = reader["lasttitle"].ToString(); info.Allowsmilies = Int32.Parse(reader["allowsmilies"].ToString()); info.Allowrss = Int32.Parse(reader["allowrss"].ToString()); info.Allowhtml = Int32.Parse(reader["allowhtml"].ToString()); info.Allowbbcode = Int32.Parse(reader["allowbbcode"].ToString()); info.Allowimgcode = Int32.Parse(reader["allowimgcode"].ToString()); info.Allowblog = Int32.Parse(reader["allowblog"].ToString()); info.Istrade = Int32.Parse(reader["istrade"].ToString()); info.Allowpostspecial = Int32.Parse(reader["allowpostspecial"].ToString()); info.Allowspecialonly = Int32.Parse(reader["allowspecialonly"].ToString()); info.Alloweditrules = Int32.Parse(reader["alloweditrules"].ToString()); info.Allowthumbnail = Int32.Parse(reader["allowthumbnail"].ToString()); info.Recyclebin = Int32.Parse(reader["recyclebin"].ToString()); info.Modnewposts = Int32.Parse(reader["modnewposts"].ToString()); info.Jammer = Int32.Parse(reader["jammer"].ToString()); info.Disablewatermark = Int32.Parse(reader["disablewatermark"].ToString()); info.Inheritedmod = Int32.Parse(reader["inheritedmod"].ToString()); info.Autoclose = Int16.Parse(reader["autoclose"].ToString()); info.Description = reader["description"].ToString(); info.Password = reader["password"].ToString(); info.Icon = reader["icon"].ToString(); info.Postcredits = reader["postcredits"].ToString(); info.Replycredits = reader["replycredits"].ToString(); info.Redirect = reader["redirect"].ToString(); info.Attachextensions = reader["attachextensions"].ToString(); info.Moderators = reader["moderators"].ToString(); info.Rules = reader["rules"].ToString(); info.Topictypes = reader["topictypes"].ToString(); info.Viewperm = reader["viewperm"].ToString(); info.Postperm = reader["postperm"].ToString(); info.Replyperm = reader["replyperm"].ToString(); info.Getattachperm = reader["getattachperm"].ToString(); info.Postattachperm = reader["postattachperm"].ToString(); info.Applytopictype = Int16.Parse(reader["applytopictype"].ToString()); info.Postbytopictype = Int16.Parse(reader["postbytopictype"].ToString()); info.Viewbytopictype = Int16.Parse(reader["viewbytopictype"].ToString()); info.Topictypeprefix = Int16.Parse(reader["topictypeprefix"].ToString()); info.Permuserlist = reader["permuserlist"].ToString(); //扩展属性 info.Havenew = reader["havenew"].ToString(); System.Text.StringBuilder sb = new System.Text.StringBuilder(); string[] moderatorslist = Utils.SplitString(reader["moderators"].ToString(), ","); if (sb.Length > 0) { sb.Remove(0, sb.Length); } for (int i = 0; i < moderatorslist.Length; i++) { if (moderstyle == 0) { if (!moderatorslist[i].Trim().Equals("")) { if (!sb.ToString().Equals("")) { sb.Append(","); } sb.Append("<a href=\"userinfo.aspx?username="******"\" target=\"_blank\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</a>"); } } else { if (!moderatorslist[i].Trim().Equals("")) { sb.Append("<option value=\""); sb.Append(moderatorslist[i].Trim()); sb.Append("\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</option>"); } } } if (!sb.ToString().Equals("") && moderstyle == 1) { sb.Insert(0, "<select style=\"width: 100px;\" onchange=\"window.open('userinfo.aspx?username=' + escape(this.value));\">"); sb.Append("</select>"); } info.Moderators = sb.ToString(); if (reader["lastpost"].ToString().Equals("")) { info.Todayposts = 0; } else { if (Convert.ToDateTime(reader["lastpost"]).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) { info.Todayposts = 0; } } if (reader["viewperm"].ToString() != "" && !Utils.InArray(usergroupid.ToString(), reader["viewperm"].ToString())) { if (hideprivate == 1) { //不显示 } else { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; coll.Add(info); } } else { coll.Add(info); } } reader.Close(); } return coll; }
public void Insert(int index, IndexPageForumInfo value) { List.Insert(index, value); }
public static Discuz.Common.Generic.List<IndexPageForumInfo> GetForumIndexCollection(int hideprivate, int usergroupid, int moderstyle, out int topiccount, out int postcount, out int todaycount) { Discuz.Common.Generic.List<IndexPageForumInfo> coll = new Discuz.Common.Generic.List<IndexPageForumInfo>(); #endif topiccount = 0; postcount = 0; todaycount = 0; IDataReader reader = DatabaseProvider.GetInstance().GetForumIndexList(); if (reader != null) { int status = 0; int colcount = 1; while (reader.Read()) { IndexPageForumInfo info = new IndexPageForumInfo(); //赋值 info.Fid = Int32.Parse(reader["fid"].ToString()); info.Parentid = Int16.Parse(reader["parentid"].ToString()); info.Layer = Int16.Parse(reader["layer"].ToString()); info.Name = reader["name"].ToString(); info.Pathlist = reader["pathlist"].ToString(); info.Parentidlist = reader["parentidlist"].ToString(); info.Subforumcount = Int32.Parse(reader["subforumcount"].ToString()); info.Status = Int32.Parse(reader["status"].ToString()); info.Colcount = Int16.Parse(reader["colcount"].ToString()); info.Displayorder = Int32.Parse(reader["displayorder"].ToString()); info.Templateid = Int16.Parse(reader["templateid"].ToString()); info.Topics = Int32.Parse(reader["topics"].ToString()); info.CurrentTopics = Int32.Parse(reader["curtopics"].ToString()); info.Posts = Int32.Parse(reader["posts"].ToString()); info.Todayposts = Int32.Parse(reader["todayposts"].ToString()); info.Lastpost = reader["lastpost"].ToString(); info.Lastposter = reader["lastposter"].ToString(); info.Lasttid = Int32.Parse(reader["lasttid"].ToString()); info.Lastposterid = Int32.Parse(reader["lastposterid"].ToString()); info.Lasttitle = reader["lasttitle"].ToString(); info.Allowsmilies = Int32.Parse(reader["allowsmilies"].ToString()); info.Allowrss = Int32.Parse(reader["allowrss"].ToString()); info.Allowhtml = Int32.Parse(reader["allowhtml"].ToString()); info.Allowbbcode = Int32.Parse(reader["allowbbcode"].ToString()); info.Allowimgcode = Int32.Parse(reader["allowimgcode"].ToString()); info.Allowblog = Int32.Parse(reader["allowblog"].ToString()); info.Istrade = Int32.Parse(reader["istrade"].ToString()); info.Allowpostspecial = Int32.Parse(reader["allowpostspecial"].ToString()); info.Allowspecialonly = Int32.Parse(reader["allowspecialonly"].ToString()); info.Alloweditrules = Int32.Parse(reader["alloweditrules"].ToString()); info.Allowthumbnail = Int32.Parse(reader["allowthumbnail"].ToString()); info.Recyclebin = Int32.Parse(reader["recyclebin"].ToString()); info.Modnewposts = Int32.Parse(reader["modnewposts"].ToString()); info.Jammer = Int32.Parse(reader["jammer"].ToString()); info.Disablewatermark = Int32.Parse(reader["disablewatermark"].ToString()); info.Inheritedmod = Int32.Parse(reader["inheritedmod"].ToString()); info.Autoclose = Int16.Parse(reader["autoclose"].ToString()); info.Description = reader["description"].ToString(); info.Password = reader["password"].ToString(); info.Icon = reader["icon"].ToString(); info.Postcredits = reader["postcredits"].ToString(); info.Replycredits = reader["replycredits"].ToString(); info.Redirect = reader["redirect"].ToString(); info.Attachextensions = reader["attachextensions"].ToString(); info.Moderators = reader["moderators"].ToString(); info.Rules = reader["rules"].ToString(); info.Topictypes = reader["topictypes"].ToString(); info.Viewperm = reader["viewperm"].ToString(); info.Postperm = reader["postperm"].ToString(); info.Replyperm = reader["replyperm"].ToString(); info.Getattachperm = reader["getattachperm"].ToString(); info.Postattachperm = reader["postattachperm"].ToString(); info.Applytopictype = Int16.Parse(reader["applytopictype"] == DBNull.Value ? "0" : reader["applytopictype"].ToString()); info.Postbytopictype = Int16.Parse(reader["postbytopictype"] == DBNull.Value ? "0" : reader["postbytopictype"].ToString()); info.Viewbytopictype = Int16.Parse(reader["viewbytopictype"] == DBNull.Value ? "0" : reader["viewbytopictype"].ToString()); info.Topictypeprefix = Int16.Parse(reader["topictypeprefix"] == DBNull.Value ? "0" : reader["topictypeprefix"].ToString()); info.Permuserlist = reader["permuserlist"].ToString(); //扩展属性 info.Havenew = reader["havenew"].ToString(); //判断是否收起 if (info.Layer == 0 && Utils.GetCookie("discuz_collapse").IndexOf("_category_" + info.Fid + "_") > -1) { info.Collapse = "display: none;"; } // if (Int32.Parse(reader["status"].ToString()) > 0) { if (Int32.Parse(reader["parentid"].ToString()) == 0 && Int32.Parse(reader["subforumcount"].ToString()) > 0) { colcount = Int32.Parse(reader["colcount"].ToString()); status = colcount; info.Status = status + 1; } else { status++; info.Status = status; info.Colcount = colcount; } } System.Text.StringBuilder sb = new System.Text.StringBuilder(); //如果当前用户权限不够 string[] moderatorslist = Utils.SplitString(reader["moderators"].ToString(), ","); if (sb.Length > 0) { sb.Remove(0, sb.Length); } for (int i = 0; i < moderatorslist.Length; i++) { if (moderstyle == 0) { if (!moderatorslist[i].Trim().Equals("")) { if (!sb.ToString().Equals("")) { sb.Append(","); } sb.Append("<a href=\"userinfo.aspx?username="******"\" target=\"_blank\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</a>"); } } else { if (!moderatorslist[i].Trim().Equals("")) { sb.Append("<option value=\""); sb.Append(moderatorslist[i].Trim()); sb.Append("\">"); sb.Append(moderatorslist[i].Trim()); sb.Append("</option>"); } } } if (!sb.ToString().Equals("") && moderstyle == 1) { sb.Insert(0, "<select style=\"width: 100px;\" onchange=\"window.open('userinfo.aspx?username=' + escape(this.value));\">"); sb.Append("</select>"); } info.Moderators = sb.ToString(); if (reader["lastpost"].ToString().Equals("")) { info.Todayposts = 0; } else { if (Convert.ToDateTime(reader["lastpost"]).ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")) { info.Todayposts = 0; } } if (Utils.StrToInt(reader["layer"], 0) > 0) { topiccount = topiccount + Utils.StrToInt(reader["topics"], 0); postcount = postcount + Utils.StrToInt(reader["posts"], 0); todaycount = todaycount + info.Todayposts; } //判断是否为私密论坛 if (reader["viewperm"].ToString() != "" && !Utils.InArray(usergroupid.ToString(), reader["viewperm"].ToString())) { if (hideprivate == 1) { //不显示 } else { info.Lasttitle = ""; info.Lastposter = ""; info.Status = -1; coll.Add(info); } } else { coll.Add(info); } } reader.Close(); Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); cache.AddObject("/NowStatistics", topiccount.ToString() + "," + postcount.ToString() + "," + todaycount.ToString()); } //return co return GetRealForumIndexCollection(coll); }
/// <summary> /// 获取版主信息 /// </summary> /// <param name="info">版块信息</param> /// <param name="moderstyle">版主显示样式,0为横排,1为下拉</param> /// <returns></returns> private static string GetModerators(IndexPageForumInfo info, int moderstyle) { StringBuilder sb = new StringBuilder(); //如果当前用户权限不够 if (sb.Length > 0) sb.Remove(0, sb.Length); foreach (string moderators in Utils.SplitString(info.Moderators, ",")) { if (moderstyle == 0) { if (!Utils.StrIsNullOrEmpty(moderators.Trim())) { if (!Utils.StrIsNullOrEmpty(sb.ToString())) sb.Append(","); sb.AppendFormat("<a href=\"{0}userinfo.aspx?username={1}\" target=\"_blank\">{2}</a>", BaseConfigs.GetForumPath, Utils.UrlEncode(moderators.Trim()), moderators.Trim()); } } else { if (!Utils.StrIsNullOrEmpty(moderators.Trim())) sb.AppendFormat("<option value=\"{0}\">{1}</option>", moderators.Trim(), moderators.Trim()); } } if (!Utils.StrIsNullOrEmpty(sb.ToString()) && moderstyle == 1) { sb.Insert(0, string.Format("<select style=\"width: 100px;\" onchange=\"window.open('{0}userinfo.aspx?username=' + escape(this.value));\">",BaseConfigs.GetForumPath)); sb.Append("</select>"); } return sb.ToString(); }