예제 #1
0
 protected string GetThreadUrl(BasicThread thread, bool isLastPage)
 {
     if (ThreadCatalogID == -1)
     {
         if (IsNormalThreads)
         {
             if (IsDefaultList)
             {
                 if (isLastPage)
                 {
                     return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, PageNumber));
                 }
                 else
                 {
                     return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, PageNumber));
                 }
             }
             else
             {
                 if (isLastPage)
                 {
                     return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, "Action=" + Action + "&page=" + PageNumber));
                 }
                 else
                 {
                     return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, "Action=" + Action + "&page=" + PageNumber));
                 }
             }
         }
         else
         {
             if (string.Compare(Action, "recycled", true) == 0)
             {
                 return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.TotalPages, thread.ThreadTypeString, "recyclebin"));
             }
             else if (string.Compare(Action, "unapproved", true) == 0)
             {
                 return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.TotalPages, thread.ThreadTypeString, "unapprovethreads"));
             }
             else
             {
                 return(BbsUrlHelper.GetThreadUrl(CodeName, thread.RedirectThreadID, thread.TotalPages, thread.ThreadTypeString, "unapproveposts"));
             }
         }
     }
     else
     {
         if (isLastPage)
         {
             return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, thread.TotalPages, "ThreadCatalogID=" + ThreadCatalogID + "&page=" + PageNumber));
         }
         else
         {
             return(BbsUrlHelper.GetThreadUrlForExtParms(CodeName, thread.RedirectThreadID, thread.ThreadTypeString, 1, "ThreadCatalogID=" + ThreadCatalogID + "&page=" + PageNumber));
         }
     }
 }
예제 #2
0
        protected string GetThreadLink(string linkStyle, BasicThread thread, int subjectLength, int page, string type, string codeName, bool typeIsExtParms, int listPage, bool addStyle)
        {
            if (thread == null || thread.ThreadID < 1)
            {
                return("-");
            }
            else
            {
                if (string.IsNullOrEmpty(linkStyle))
                {
                    linkStyle = "<a href=\"{0}\">{1}</a>";
                }

                string threadSubjectStyle;
                if (addStyle == false || string.IsNullOrEmpty(thread.SubjectStyle))
                {
                    threadSubjectStyle = "<span>";
                }
                else
                {
                    threadSubjectStyle = "<span style=\"" + thread.SubjectStyle + "\">";
                }


                string subject;
                if (thread.ThreadType == ThreadType.Move || thread.ThreadType == ThreadType.Join)
                {
                    int index = thread.Subject.IndexOf(',');
                    if (index > 0)
                    {
                        string threadIDStr = thread.Subject.Substring(0, index);

                        int threadID;
                        if (int.TryParse(threadIDStr, out threadID))
                        {
                            BasicThread tempThread = PostBOV5.Instance.GetThread(threadID);
                            Forum       forum      = null;
                            if (tempThread != null)
                            {
                                forum = ForumBO.Instance.GetForum(tempThread.ForumID, false);
                            }

                            subject = thread.Subject.Substring(index + 1);

                            string threadTypeString;
                            if (thread.ThreadType == ThreadType.Move)
                            {
                                threadTypeString = "已移动: ";
                            }
                            else
                            {
                                threadTypeString = "已合并: ";
                            }

                            if (forum == null)
                            {
                                forum = ForumBO.Instance.GetForum(thread.ForumID);
                            }

                            string url;
                            if (typeIsExtParms)
                            {
                                url = BbsUrlHelper.GetThreadUrlForExtParms(forum.CodeName, threadID, page, type);
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(type))
                                {
                                    url = BbsUrlHelper.GetThreadUrl(forum.CodeName, threadID, thread.ThreadTypeString, page, listPage);
                                }
                                else
                                {
                                    url = BbsUrlHelper.GetThreadUrl(forum.CodeName, threadID, thread.ThreadTypeString, page, type);
                                }
                            }
                            string cutSubject = CutString(threadTypeString + subject, subjectLength);

                            return(string.Format(linkStyle, url, threadSubjectStyle + cutSubject + "</span>", subject));
                        }
                    }
                }

                subject = CutString(thread.Subject, subjectLength);
                Forum  forum2 = ForumBO.Instance.GetForum(thread.ForumID);
                string endStatus;
                if (thread.ThreadType == ThreadType.Question)
                {
                    endStatus = thread.IsClosed ? " [已解决]" : " [未解决]";
                }
                else if (thread.ThreadType == ThreadType.Poll)
                {
                    endStatus = thread.IsClosed ? " [已结束]" : " [投票中]";
                }
                else
                {
                    endStatus = string.Empty;
                }

                string url2;
                string tempCodeName;
                if (string.IsNullOrEmpty(codeName))
                {
                    tempCodeName = forum2.CodeName;
                }
                else
                {
                    tempCodeName = codeName;
                }

                if (typeIsExtParms)
                {
                    url2 = BbsUrlHelper.GetThreadUrlForExtParms(tempCodeName, thread.ThreadID, thread.ThreadTypeString, page, type);
                }
                else
                {
                    if (string.IsNullOrEmpty(type))
                    {
                        url2 = BbsUrlHelper.GetThreadUrl(tempCodeName, thread.ThreadID, thread.ThreadTypeString, page, listPage);
                    }
                    else
                    {
                        url2 = BbsUrlHelper.GetThreadUrl(tempCodeName, thread.ThreadID, thread.ThreadTypeString, page, type);
                    }
                }

                return(string.Format(linkStyle, url2, threadSubjectStyle + subject + "</span>", thread.Subject) + endStatus);
            }
        }