Beispiel #1
0
        public string GetThreadUrl()
        {
            if (_currentRow == null)
            {
                return(null);
            }

            var forumId = _currentRow["ForumID"].ToString();
            var topicId = _currentRow["TopicId"].ToString();

            var @params = new List <string> {
                ParamKeys.ForumId + "=" + forumId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.TopicId + "=" + topicId
            };


            if (SocialGroupId > 0)
            {
                @params = new List <string> {
                    ParamKeys.TopicId + "=" + topicId
                }
            }
            ;
            @params.Add("GroupId=" + SocialGroupId.ToString());

            return(NavigateUrl(TabId, string.Empty, @params.ToArray()));
        }
Beispiel #2
0
        private string GetLastPostSubject(int LastPostID, int ParentPostID, int ForumID, int TabID, string Subject, int Length, int PageSize, Forum fi)
        {
            //TODO: Verify that this will still jump to topics on page 2
            var sb     = new StringBuilder();
            int PostId = LastPostID;

            Subject = Utilities.StripHTMLTag(Subject);
            Subject = Subject.Replace("[", "&#91");
            Subject = Subject.Replace("]", "&#93");
            if (Subject.Length > Length & Length > 0)
            {
                Subject = Subject.Substring(0, Length) + "...";
            }
            if (LastPostID != 0)
            {
                string sTopicURL;
                var    ctlUtils = new ControlUtils();
                sTopicURL = ctlUtils.BuildUrl(ForumTabId, ForumModuleId, fi.ForumGroup.PrefixURL, fi.PrefixURL, fi.ForumGroupId, ForumID, ParentPostID, fi.TopicUrl, -1, -1, string.Empty, 1, -1, SocialGroupId);

                string sURL;
                if (ParentPostID == 0 || LastPostID == ParentPostID)
                {
                    sURL = sTopicURL;
                    //If UseShortUrls Then
                    //    sURL = Utilities.NavigateUrl(TabID, "", New String() {ParamKeys.TopicId & "=" & PostId})
                    //Else
                    //    sURL = Utilities.NavigateUrl(TabID, "", New String() {ParamKeys.ForumId & "=" & ForumID, ParamKeys.ViewType & "=" & Views.Topic, ParamKeys.TopicId & "=" & PostId})
                    //End If
                }
                else
                {
                    if (sTopicURL.EndsWith("/"))
                    {
                        sURL = sTopicURL + "?" + ParamKeys.ContentJumpId + "=" + PostId;
                    }
                    else
                    {
                        var @params = new List <string> {
                            ParamKeys.TopicId + "=" + ParentPostID, ParamKeys.ContentJumpId + "=" + PostId
                        };

                        if (SocialGroupId > 0)
                        {
                            @params.Add("GroupId=" + SocialGroupId.ToString());
                        }

                        sURL = Utilities.NavigateUrl(TabID, "", @params.ToArray());
                    }
                }
                sb.Append("<a href=\"" + sURL + "\">" + Utilities.HTMLEncode(Subject) + "</a>");
            }
            return(sb.ToString());
        }
Beispiel #3
0
        public string GetProperty(string propertyName, string format, System.Globalization.CultureInfo formatProvider, Entities.Users.UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
        {
            string OutputFormat = string.Empty;

            if (format == string.Empty)
            {
                OutputFormat = "g";
            }
            else
            {
                OutputFormat = format;
            }
            propertyName = propertyName.ToLowerInvariant();
            switch (propertyName)
            {
            case "journalid":
                return(PropertyAccess.FormatString(JournalId.ToString(), format));

            case "journaltypeid":
                return(PropertyAccess.FormatString(JournalTypeId.ToString(), format));

            case "profileid":
                return(PropertyAccess.FormatString(ProfileId.ToString(), format));

            case "socialgroupid":
                return(PropertyAccess.FormatString(SocialGroupId.ToString(), format));

            case "datecreated":
                return(PropertyAccess.FormatString(DateCreated.ToString(), format));

            case "title":
                return(PropertyAccess.FormatString(Title, format));

            case "summary":
                return(PropertyAccess.FormatString(Summary, format));

            case "body":
                return(PropertyAccess.FormatString(Body, format));

            case "timeframe":
                return(PropertyAccess.FormatString(TimeFrame, format));

            case "isdeleted":
                return(IsDeleted.ToString());
            }

            propertyNotFound = true;
            return(string.Empty);
        }
Beispiel #4
0
        public string GetSearchUrl()
        {
            var @params = new List <string> {
                ParamKeys.ViewType + "=searchadvanced"
            };

            @params.AddRange(Parameters);

            if (SocialGroupId > 0)
            {
                @params.Add("GroupId=" + SocialGroupId.ToString());
            }

            return(NavigateUrl(TabId, string.Empty, @params.ToArray()));
        }
Beispiel #5
0
        private void lnkSearch_Click(object sender, EventArgs e)
        {
            if (txtSearch.Text.Trim() != "")
            {
                var @params = new List <string> {
                    ParamKeys.ViewType + "=search", ParamKeys.ForumId + "=" + ForumId, "q=" + HttpUtility.UrlEncode(txtSearch.Text.Trim())
                };

                if (SocialGroupId > 0)
                {
                    @params.Add("GroupId=" + SocialGroupId.ToString());
                }

                Response.Redirect(NavigateUrl(TabId, "", @params.ToArray()));
            }
        }
Beispiel #6
0
        public string GetMiniPager()
        {
            if (_currentRow == null)
            {
                return(null);
            }

            var replyCount = Convert.ToInt32(_currentRow["ReplyCount"]);
            var pageCount  = Convert.ToInt32(Math.Ceiling((double)(replyCount + 1) / _pageSize));
            var forumId    = _currentRow["ForumId"].ToString();
            var topicId    = _currentRow["TopicId"].ToString();

            // No pager if there is only one page.
            if (pageCount <= 1)
            {
                return(null);
            }

            List <string> @params;

            var result = string.Empty;

            if (pageCount <= 5)
            {
                for (var i = 1; i <= pageCount; i++)
                {
                    @params = new List <string> {
                        ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.PageId + "=" + i
                    };

                    if (SocialGroupId > 0)
                    {
                        @params.Add("GroupId=" + SocialGroupId.ToString());
                    }

                    result += "<a href=\"" + NavigateUrl(TabId, string.Empty, @params.ToArray()) + "\">" + i + "</a>";
                }

                return(result);
            }

            // 1 2 3 ... N

            for (var i = 1; i <= 3; i++)
            {
                @params = new List <string> {
                    ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.PageId + "=" + i
                };
                if (SocialGroupId > 0)
                {
                    @params.Add("GroupId=" + SocialGroupId.ToString());
                }

                result += "<a href=\"" + NavigateUrl(TabId, string.Empty, @params.ToArray()) + "\">" + i + "</a>";
            }

            result += "<span>...</span>";

            @params = new List <string>  {
                ParamKeys.ForumId + "=" + forumId, ParamKeys.TopicId + "=" + topicId, ParamKeys.ViewType + "=" + Views.Topic, ParamKeys.PageId + "=" + pageCount
            };
            if (SocialGroupId > 0)
            {
                @params.Add("GroupId=" + SocialGroupId.ToString());
            }

            result += "<a href=\"" + NavigateUrl(TabId, string.Empty, @params.ToArray()) + "\">" + pageCount + "</a>";

            return(result);
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var searchText     = txtSearch.Text;
            var authorUsername = txtUserName.Text;
            var tags           = txtTags.Text;

            if (string.IsNullOrWhiteSpace(searchText) && string.IsNullOrWhiteSpace(authorUsername) && string.IsNullOrWhiteSpace(tags))
            {
                return;
            }

            // Query
            if (!string.IsNullOrWhiteSpace(searchText))
            {
                searchText = Utilities.XSSFilter(searchText);
                searchText = Utilities.StripHTMLTag(searchText);
                searchText = Utilities.CheckSqlString(searchText);
                searchText = searchText.Trim();
            }

            // Author Name
            if (!string.IsNullOrWhiteSpace(authorUsername))
            {
                authorUsername = txtUserName.Text;
                authorUsername = Utilities.CheckSqlString(authorUsername);
                authorUsername = Utilities.XSSFilter(authorUsername);
                authorUsername = authorUsername.Trim();
            }

            // Tags
            if (!string.IsNullOrWhiteSpace(tags))
            {
                tags = Utilities.XSSFilter(tags);
                tags = Utilities.StripHTMLTag(tags);
                tags = Utilities.CheckSqlString(tags);
                tags = tags.Trim();
            }

            // Search Type, Search Column & Search Days
            var searchType    = Convert.ToInt32(drpSearchType.SelectedItem.Value);
            var searchColumns = Convert.ToInt32(drpSearchColumns.SelectedItem.Value);
            var searchDays    = Convert.ToInt32(drpSearchDays.SelectedItem.Value);
            var resultType    = Convert.ToInt32(drpResultType.SelectedItem.Value);
            var sort          = Convert.ToInt32(drpSort.SelectedValue);

            // Selected Forums
            var forums = string.Empty;

            // If the "All" item is selected, we don't need pass the forums parameter
            if (!lbForums.Items[0].Selected)
            {
                var forumId = 0;

                foreach (var item in lbForums.Items.Cast <ListItem>().Where(item => item.Selected && int.TryParse(Regex.Replace(item.Value, @"F(\d+)G\d+", "$1"), out forumId)))
                {
                    if (forums != string.Empty)
                    {
                        forums += ":";
                    }

                    forums += forumId;
                }
            }

            var @params = new List <string> {
                ParamKeys.ViewType + "=search"
            };

            if (!string.IsNullOrWhiteSpace(searchText))
            {
                @params.Add("q=" + Server.UrlEncode(searchText));
            }

            if (!string.IsNullOrWhiteSpace(tags))
            {
                @params.Add("tg=" + Server.UrlEncode(tags));
            }

            if (searchType > 0)
            {
                @params.Add("k=" + searchType);
            }

            if (searchColumns > 0)
            {
                @params.Add("c=" + searchColumns);
            }

            if (searchDays > 0)
            {
                @params.Add("ts=" + searchDays);
            }

            if (resultType > 0)
            {
                @params.Add("rt=" + resultType);
            }

            if (sort > 0)
            {
                @params.Add("srt=" + sort);
            }


            if (!string.IsNullOrWhiteSpace(authorUsername))
            {
                @params.Add("author=" + Server.UrlEncode(authorUsername));
            }

            if (!string.IsNullOrWhiteSpace(forums))
            {
                @params.Add("f=" + Server.UrlEncode(forums));
            }

            if (SocialGroupId > 0)
            {
                @params.Add("GroupId=" + SocialGroupId.ToString());
            }

            Response.Redirect(NavigateUrl(TabId, string.Empty, @params.ToArray()));
        }