Beispiel #1
0
        public virtual ActionResult AddEditFeed(long siteId)
        {
            var site = _siteBusiness.GetList().SingleOrDefault(s => s.Id == siteId);

            ViewBag.Id = siteId;
            var model = new List <FeedViewModel>();

            if (site == null)
            {
                return(View("AddWebSite", model));
            }
            else
            {
                model = site.Feeds.Select(f => new FeedViewModel()
                {
                    FeedId      = f.Id,
                    Title       = f.Title,
                    Description = f.Description,
                    FeedType    = f.FeedType.HasValue ? f.FeedType.Value : Common.Share.FeedType.Rss,
                    Link        = f.Link,
                    SiteId      = f.SiteId
                }).ToList();
                return(View("AddFeedsToSite", model));
            }
        }
Beispiel #2
0
        public virtual JsonResult Site_Read([DataSourceRequest] DataSourceRequest request, string url, string title)
        {
            var query = _siteBusiness.GetList();

            if (!request.Sorts.Any())
            {
                request.Sorts.Add(new Kendo.Mvc.SortDescriptor("Id", System.ComponentModel.ListSortDirection.Descending));
            }

            var sites = query.Select(s => new SiteViewModel
            {
                Id              = s.Id,
                SiteTitle       = s.SiteTitle,
                SiteUrl         = s.SiteUrl,
                PageRank        = s.PageRank,
                CrawledCount    = s.CrawledCount,
                HasFeed         = s.HasFeed,
                IsBlog          = s.IsBlog,
                HasSocialTag    = s.HasSocialTag,
                SkipType        = s.SkipType,
                ShowContentType = s.ShowContentType
            });

            return(Json(sites.ToDataSourceResult(request), JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public virtual ActionResult Index()
        {
            var model      = new ReaderModel();
            var membership = new WebLogic.CmsMembership(_userBusiness);
            var MUser      = membership.GetCurrentUser();

            model.UserTitle = membership.GetCurrentUserTitle();
            ViewBag.Title   = "صفحه شخصی " + model.UserTitle;
            model.Tags      = _tagBusiness.GetList()
                              .Where(x => x.Users.Any(c => c.Id == MUser.Id)).Select(t => new TagViewModel()
            {
                Id      = t.Id,
                Title   = t.Title,
                EnValue = t.EnValue
            }).ToList();

            model.Categories = _categoryBusiness.GetList().Where(x => x.Users.Any(c => c.Id == MUser.Id)).
                               Select(c => new CategoryViewModel
            {
                Id       = c.Id,
                Title    = c.Title,
                Code     = c.Code,
                ParentId = c.ParentId
            })
                               .ToList();
            model.Categories.ForEach(x => x.ParentId = x.ParentId > 0 && model.Categories.Any(y => y.Id == x.ParentId) ? x.ParentId : 0);
            model.Sites = _siteBusiness.GetList().Where(x => x.Users.Any(c => c.Id == MUser.Id))
                          .Select(x => new SiteOnlyTitle {
                Id = x.Id, SiteUrl = x.SiteUrl, SiteTitle = x.SiteTitle
            }).ToList();

            model.RecomendTags = _recomendBiz.Tags(10, model.Tags.Select(t => t.Id).ToList()).Select(t => new TagViewModel()
            {
                Id      = t.Id,
                Title   = t.Title,
                EnValue = t.EnValue
            }).ToList();
            model.RecomendCats = _recomendBiz.Cats(5).Select(c => new CategoryViewModel()
            {
                Id    = c.Id,
                Title = c.Title,
                Code  = c.Code
            }).ToList();
            model.RecomendSites = _recomendBiz.Sites(10, model.Sites.Select(s => s.Id).ToList());

            return(View("Index." + CmsConfig.ThemeName, model));
        }
Beispiel #4
0
        public virtual ActionResult Index(int page = 1)
        {
            var model = new DashboardModel();
            var today = DateTime.Today;

            model.SitesCount = _siteBusiness.GetList().Count();

            model.Feeds            = _feedBusiness.GetList().OrderByDescending(f => f.LastUpdateDateTime).Take(10).ToList();
            model.ActiveFeedsCount = _feedBusiness.GetList().Where(f => f.Deleted == Common.Share.DeleteStatus.Active).Count();
            model.TodayFeedsCount  = _feedBusiness.GetList().Where(f => f.LastUpdateDateTime >= today).Count();

            model.Comments   = _commentBiz.GetList().OrderByDescending(c => c.Id).Take(8).ToList();
            model.Posts      = _postBiz.GetList().Where(p => p.PostType == PostType.News).OrderByDescending(p => p.Id).Take(8).ToList();
            model.PostsCount = _postBiz.GetList().Count();

            model.UsersCount = _userBusiness.GetList().Count();
            model.Users      = _userBusiness.GetList().OrderByDescending(u => u.Id).Take(8).ToList();

            model.MessagesCount = _contactBusiness.GetList().Count();

            model.TodayItemsCount = _feedItemBusiness.GetList().Where(t => t.CreateDate >= today).Count();

            return(View(model));
        }
Beispiel #5
0
        public virtual ActionResult Index(string Content, int PageIndex)
        {
            Content = Content.ReplaceX("www.", "");
            var siteCurrents = _siteBusiness.GetList(Content);

            if (siteCurrents.Count() == 0)
            {
                var startw = Content.Remove(Content.LastIndexOf(".") + 1, Content.Length - Content.LastIndexOf(".") - 1);
                siteCurrents = _siteBusiness.GetList(startw);
                if (!siteCurrents.Any())
                {
                    return(RedirectToAction(MVC.Error.notfound()));
                }
            }
            var siteCurrent = siteCurrents.First();

            #region ViewBag
            //ViewBag.EntityCode = "Site";
            ViewBag.EnTityRef = siteCurrent.Id;

            ViewBag.Title   = siteCurrent.SiteTitle + " " + siteCurrent.SiteUrl;
            ViewBag.Content = siteCurrent.SiteUrl;
            //ViewBag.KeyWords = siteCurrent.SiteTags;
            //ViewBag.PageSize = PageSize;
            ViewBag.SearchTextDir = "text-align:left;direction:ltr";
            ViewBag.siteCurrent   = siteCurrent;
            ViewBag.PageHeader    = "تازه ترین های " + siteCurrent.SiteTitle + " (" + siteCurrent.SiteUrl + ")";
            ViewBag.PageIndex     = PageIndex + 1;
            ViewBag.KeyWords      = "," + siteCurrent.SiteUrl + "," + siteCurrent.SiteTitle + ",اخبار روز,تازه ترین خبرها,خبرخوان";
            ViewBag.Discription   = "تازه ترین مطالب سایت " + siteCurrent.SiteTitle + " - " + siteCurrent.SiteUrl + " - " + siteCurrent.SiteDesc;
            #endregion
            var LastItemPubDate = DateTime.Now.AddMinutes(-15);
            var res             = _feedItemBusiness.FeedItemsBySite(siteCurrent.Id, PageSize, PageIndex, false);

            if (res.Count == 0)
            {
                res = _feedItemBusiness.FeedItemsByCat(6, PageSize, PageIndex, false);
            }

            if (siteCurrent.HasImage != HasImage.NotSupport)
            {
                ViewBag.VisualItems = _feedItemBusiness.FeedItemsBySite(siteCurrent.Id, _appConfigBiz.GetVisualPostCount() + _appConfigBiz.GetVisualPostCount(), PageIndex, true);
            }

            #region Related Site
            //----------------Related Site by this site-------
            ViewBag.TopSites = siteCurrent.Feeds.SelectMany(f => f.Categories)
                               .SelectMany(cf => cf.Feeds).Select(f2 => f2.Site).Take(20).ToList()
                               .Select(s => new SiteOnlyTitle()
            {
                SiteUrl = s.SiteUrl, SiteTitle = s.SiteTitle
            }).DistinctBy(x => x.SiteUrl).ToList();
            #endregion
            if (!(ViewBag.TopSites as List <SiteOnlyTitle>).Any())
            {
                ViewBag.TopSites = _siteBusiness.GetTopSites(15, 120);
            }
            #region Tabs
            //var cats = siteCurrent.Feeds.SelectMany(f => f.Categories.Select(cf => cf.Id)).ToList();
            //ViewBag.RemoteWebParts = Ioc.RemoteWpBiz.GetByCats(cats).ToList();
            //ViewBag.Pages = _postBiz.GetList().Where(p => p.PostType == PostType.Tab && p.Categories.Any(pc => cats.Contains(pc.Id))).ToList();
            #endregion
            return(View("Index." + CmsConfig.ThemeName, res));
        }