예제 #1
0
        public static MvcHtmlString LikeTable(this HtmlHelper html, int id, string type, string rating, int userid)
        {
            UrlHelper url    = new UrlHelper(html.ViewContext.RequestContext, html.RouteCollection);
            string    result = "";

            result += "<div class=\"bars\"><div class=\"like\" title=\"" + OK.TopicPoint(rating, 3) + "%\" style=\"width: " + 180 * OK.TopicPoint(rating, 3) / 100 + "px;\"></div><div class=\"dislike\" title=\"" + OK.TopicPoint(rating, 4) + "%\" style=\"width: " + 180 * OK.TopicPoint(rating, 4) / 100 + "px;\"></div></div>";
            string msg = "";

            if (OK.TopicPoint(rating, 1) + OK.TopicPoint(rating, 2) == 0)
            {
                msg = "İlk oylayan sen ol";
            }
            else if (OK.RatingScore(id, type, userid) == 0)
            {
                msg = "Bunu değerlendir";
            }
            else if (OK.RatingScore(id, type, userid) == 1)
            {
                msg = "Bunu beğendin";
            }
            else if (OK.RatingScore(id, type, userid) == -1)
            {
                msg = "Bunu beğenmedin";
            }
            result += "<div class=\"info\"><div class=\"like-b\" title=\"Beğen\" onclick=\"UpdateRating('" + id + "', '+1', '" + type + "');\">&nbsp;</div><div class=\"like-c\">" + OK.TopicPoint(rating, 1) + "</div><div class=\"msg\">" + msg + "</div><div class=\"dislike-b\" title=\"Beğenme\" onclick=\"UpdateRating('" + id + "', '-1', '" + type + "');\">&nbsp;</div><div class=\"dislike-c\">" + OK.TopicPoint(rating, 2) + "</div></div>";
            return(MvcHtmlString.Create(result));
        }
예제 #2
0
 public override void OnActionExecuting(ActionExecutingContext filterContext)
 {
     if (OK.ClubConfig("site-on/off") == "0" && HttpContext.Current.Session["memberrole"].ToString() != "10")
     {
         filterContext.Result = new EmptyResult();
         filterContext.Result = new RedirectResult("~/error/siteOff");
     }
     base.OnActionExecuting(filterContext);
 }
예제 #3
0
        public static MvcHtmlString UserRating(this HtmlHelper html, int rating)
        {
            string result = "";
            int    rate   = OK.UserRating(rating);

            for (int i = 0; i < rate; i++)
            {
                result += "<span style=\"background-position: 0 -32px;\"> </span>";
            }
            for (int i = 0; i < 5 - rate; i++)
            {
                result += "<span> </span>";
            }
            return(MvcHtmlString.Create(result));
        }
예제 #4
0
        public static int FindCommentPage(comment comment)
        {
            var comments = comment.topic.comments.Where(x => x.IsApproval == true).OrderBy(x => x.CreationDate);
            int take     = Convert.ToInt32(OK.Config("comment-paging-count"));
            int count    = 0;
            int page     = 1;

            foreach (var item in comments)
            {
                count++;
                if (item == comment)
                {
                    page = count % take == 0 ? count / take : count / take + 1;
                    break;
                }
            }
            return(page);
        }
예제 #5
0
        public static MvcHtmlString ViewComment(this HtmlHelper html, comment comment)
        {
            UrlHelper url    = new UrlHelper(html.ViewContext.RequestContext, html.RouteCollection);
            string    result = "";
            string    quote  = comment.QuoteId;

            if (!string.IsNullOrEmpty(quote))
            {
                OKDbEntities Db = new OKDbEntities();
                int          id = Convert.ToInt32(quote.Split('-')[1]);
                if (quote.Split('-')[0] == "t")
                {
                    var quotetopic = Db.topic.Find(id);
                    result = "<div style=\"max-height: 300px; overflow-x: hidden; overflow-y: scroll;\"><blockquote><b>" + OK.UserName(quotetopic.user) + "</b>, <small>" + html.ShortDateTime((DateTime)quotetopic.CreationDate) + "</small><small style=\"float: right;\"><a href=\"" + url.Action("GoTopic", new { id = quotetopic.Id }) + "\">Konuya Git</a></small><div class=\"comment\">" + html.ViewTopic(quotetopic.Content) + "</blockquote></div>";
                }
                else
                {
                    var quotecomment = Db.comment.Find(id);
                    result = "<div style=\"max-height: 300px; overflow-x: hidden; overflow-y: scroll;\"><blockquote><b>" + OK.UserName(quotecomment.user) + "</b>, <small>" + html.ShortDateTime((DateTime)quotecomment.CreationDate) + "</small><small style=\"float: right;\"><a href=\"" + url.Action("GoComment", new { id = quotecomment.Id }) + "\">Cevaba Git</a></small><div class=\"comment\">" + html.ViewComment(quotecomment) + "</blockquote></div>";
                }
            }
            result += comment.Content;
            return(MvcHtmlString.Create(result.ToString()));
        }
예제 #6
0
        public static MvcHtmlString UserInfo(this HtmlHelper html, int id)
        {
            OKDbEntities Db     = new OKDbEntities();
            string       result = "";
            UrlHelper    url    = new UrlHelper(html.ViewContext.RequestContext, html.RouteCollection);
            var          user   = Db.user.Single(x => x.Id == id);

            result = "<div class=\"image\" onclick=\"$.OK.Modal('" + url.Action("UserInfo", "Account", new { id = id }) + "');\"><img src=\"" + user.ImageFile + "\" /></div>" +
                     "<div class=\"name\" onclick=\"$.OK.Modal('" + url.Action("UserInfo", "Account", new { id = id }) + "');\">" + OK.UserName(user) + "<img src=\"" + url.Content("~/Areas/Forum/Themes/" + OK.Config("site-theme") + "/Images/" + OK.UserState(user.Id, (DateTime)user.LastLoginDate) + ".png") + "\" /></div>" +
                     "<div class=\"level\">" + user.type.Name + "</div>" +
                     "<div class=\"rating\">" + html.UserRating((int)user.Rating) + "</div>";
            return(MvcHtmlString.Create("<div class=\"user-info\">" + result + "</div>"));
        }