Esempio n. 1
0
 public static int GetCommentCountBySiteAndType(Guid siteID, ContentPageType.PageType pageType, bool?approved, bool?spam)
 {
     using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
         return((from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType, approved, spam)
                 select c).Count());
     }
 }
Esempio n. 2
0
        internal SiteMapOrder(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.SiteID           = c.SiteID;
                this.Root_ContentID   = c.Root_ContentID;
                this.PageActive       = c.PageActive;
                this.Parent_ContentID = c.Parent_ContentID;
                this.NavMenuText      = c.NavMenuText;
                this.FileName         = c.FileName;
                this.NavOrder         = c.NavOrder;

                if (this.Parent_ContentID.HasValue)
                {
                    this.NavLevel = 0;
                }
                else
                {
                    this.NavLevel = 10;
                }

                this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
                this.CreateDate  = site.ConvertUTCToSiteTime(c.CreateDate);
                this.GoLiveDate  = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate  = site.ConvertUTCToSiteTime(c.RetireDate);
            }
        }
        public void FetchItem()
        {
            guidItemID = GetGuidIDFromQuery();
            item       = PostComment.GetContentCommentByID(guidItemID);

            pageType = ContentPageType.PageType.Unknown;

            if (item != null)
            {
                guidRootContentID = item.Root_ContentID;
            }

            if (guidRootContentID != Guid.Empty)
            {
                ContentPage pageContents = pageHelper.FindContentByID(SiteID, guidRootContentID);
                pageType = pageContents.ContentType;
            }

            ReturnPageQueryString = "";
            if (IsFullSite)
            {
                ReturnPageQueryString = string.Format("type={0}", pageType);
            }
            else
            {
                ReturnPageQueryString = string.Format("id={0}", guidRootContentID);
            }

            ReturnPageURL = string.Format("{0}?{1}", ReturnPage, ReturnPageQueryString);
        }
		internal SiteMapOrder(vw_carrot_Content c) {
			if (c != null) {
				SiteData site = SiteData.GetSiteFromCache(c.SiteID);

				this.SiteID = c.SiteID;
				this.Root_ContentID = c.Root_ContentID;
				this.PageActive = c.PageActive;
				this.ShowInSiteNav = c.ShowInSiteNav;
				this.Parent_ContentID = c.Parent_ContentID;
				this.NavMenuText = c.NavMenuText;
				this.FileName = c.FileName;
				this.NavOrder = c.NavOrder;

				if (this.Parent_ContentID.HasValue) {
					this.NavLevel = 0;
				} else {
					this.NavLevel = 10;
				}

				this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
				this.CreateDate = site.ConvertUTCToSiteTime(c.CreateDate);
				this.GoLiveDate = site.ConvertUTCToSiteTime(c.GoLiveDate);
				this.RetireDate = site.ConvertUTCToSiteTime(c.RetireDate);
			}
		}
        protected void SetGrid(bool bAll, DateTime dateRange, int dateRangeDays)
        {
            List <ContentPage> lstContent = null;

            if (bAll)
            {
                dateRangeDays = -1;
            }
            ContentPageType.PageType pageType = ContentPageType.PageType.Unknown;

            if (rdoPost.Checked)
            {
                pageType = ContentPageType.PageType.BlogEntry;
            }
            if (rdoPage.Checked)
            {
                pageType = ContentPageType.PageType.ContentEntry;
            }

            lstContent = pageHelper.GetContentByDateRange(SiteID, dateRange, dateRangeDays, pageType,
                                                          GeneralUtilities.GetNullableBoolValue(ddlActive), GeneralUtilities.GetNullableBoolValue(ddlSiteMap),
                                                          GeneralUtilities.GetNullableBoolValue(ddlNavigation), GeneralUtilities.GetNullableBoolValue(ddlHide));

            lblPages.Text = string.Format(" {0} ", lstContent.Count);

            GeneralUtilities.BindDataBoundControl(gvPages, lstContent);
        }
Esempio n. 6
0
 public int GetSitePageCount(ContentPageType.PageType entryType)
 {
     using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
         int iCount = CannedQueries.GetAllByTypeList(_db, this.SiteID, false, entryType).Count();
         return(iCount);
     }
 }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["type"])) {
                pageType = ContentPageType.GetTypeByName(Request.QueryString["type"].ToString());
            }

            guidRootContentID = GetGuidIDFromQuery();

            BindData();
        }
		protected void Page_Load(object sender, EventArgs e) {
			if (!String.IsNullOrEmpty(Request.QueryString["type"])) {
				pageType = ContentPageType.GetTypeByName(Request.QueryString["type"].ToString());
			}

			if (pageType == ContentPageType.PageType.ContentEntry) {
				Master.ActivateTab(AdminBaseMasterPage.SectionID.PageComment);
			} else {
				Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogComment);
			}
		}
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["type"]))
            {
                pageType = ContentPageType.GetTypeByName(Request.QueryString["type"].ToString());
            }

            if (pageType == ContentPageType.PageType.ContentEntry)
            {
                Master.ActivateTab(AdminBaseMasterPage.SectionID.PageComment);
            }
            else
            {
                Master.ActivateTab(AdminBaseMasterPage.SectionID.BlogComment);
            }
        }
Esempio n. 10
0
        public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly,
                                                        int pageSize, int pageNumber, string sortField, string sortDir)
        {
            IQueryable <vw_carrot_Content> query1 = null;

            if (postType == ContentPageType.PageType.ContentEntry)
            {
                query1 = CannedQueries.GetLatestContentList(db, siteID, bActiveOnly);
            }
            else
            {
                query1 = CannedQueries.GetLatestBlogList(db, siteID, bActiveOnly);
            }

            return(PerformDataPagingQueryableContent(siteID, bActiveOnly, pageSize, pageNumber, sortField, sortDir, query1));
        }
		protected void Page_Load(object sender, EventArgs e) {
			if (!String.IsNullOrEmpty(Request.QueryString["type"])) {
				pageType = ContentPageType.GetTypeByName(Request.QueryString["type"].ToString());
			}

			if (!IsPostBack) {
				ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();

				GeneralUtilities.BindOptionalYesNoList(ddlActive);
				GeneralUtilities.BindOptionalYesNoList(ddlSpam);
			}

			guidRootContentID = GetGuidIDFromQuery();

			BindData();
		}
		internal BasicContentData(vw_carrot_Content c) {
			if (c != null) {
				SiteData site = SiteData.GetSiteFromCache(c.SiteID);

				this.SiteID = c.SiteID;
				this.Root_ContentID = c.Root_ContentID;
				this.PageActive = c.PageActive;
				this.Parent_ContentID = c.Parent_ContentID;
				this.FileName = c.FileName;
				this.TemplateFile = c.TemplateFile;
				this.NavOrder = c.NavOrder;

				this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
				this.CreateDate = site.ConvertUTCToSiteTime(c.CreateDate);
				this.GoLiveDate = site.ConvertUTCToSiteTime(c.GoLiveDate);
				this.RetireDate = site.ConvertUTCToSiteTime(c.RetireDate);
			}
		}
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(Request.QueryString["type"]))
            {
                pageType = ContentPageType.GetTypeByName(Request.QueryString["type"].ToString());
            }

            if (!IsPostBack)
            {
                ddlSize.SelectedValue = pagedDataGrid.PageSize.ToString();

                GeneralUtilities.BindOptionalYesNoList(ddlActive);
                GeneralUtilities.BindOptionalYesNoList(ddlSpam);
            }

            guidRootContentID = GetGuidIDFromQuery();

            BindData();
        }
Esempio n. 14
0
 internal PostComment(vw_carrot_Comment c)
 {
     if (c != null)
     {
         this.ContentCommentID = c.ContentCommentID;
         this.Root_ContentID   = c.Root_ContentID;
         this.CreateDate       = SiteData.CurrentSite.ConvertUTCToSiteTime(c.CreateDate);
         this.CommenterIP      = c.CommenterIP;
         this.CommenterName    = c.CommenterName;
         this.CommenterEmail   = c.CommenterEmail;
         this.CommenterURL     = c.CommenterURL;
         this.PostCommentText  = c.PostComment;
         this.IsApproved       = c.IsApproved;
         this.IsSpam           = c.IsSpam;
         this.NavMenuText      = c.NavMenuText;
         this.FileName         = c.FileName;
         this.ContentType      = ContentPageType.GetTypeByID(c.ContentTypeID);
     }
 }
Esempio n. 15
0
        public ContentPage(Guid siteID, ContentPageType.PageType pageType)
        {
            this.Root_ContentID = Guid.Empty;
            this.ContentID      = Guid.NewGuid();
            this.ContentType    = pageType;
            this.SiteID         = siteID;
            this.VersionCount   = 0;
            this.NavOrder       = -1;

            DateTime siteTime = SiteData.GetSiteByID(siteID).Now;

            this.CreateDate = siteTime;
            this.EditDate   = siteTime;
            this.GoLiveDate = siteTime.AddMinutes(-5);
            this.RetireDate = siteTime.AddYears(200);

            //this.NavMenuText = "PAGE " + this.Root_ContentID.ToString().ToLowerInvariant();
            //this.FileName = "/" + this.Root_ContentID.ToString().ToLowerInvariant();
            this.NavMenuText  = String.Empty;
            this.FileName     = String.Empty;
            this.TemplateFile = SiteData.DefaultTemplateFilename;

            this.BlockIndex    = false;
            this.PageActive    = true;
            this.ShowInSiteMap = true;
            this.ShowInSiteNav = true;

            this.LeftPageText  = PageContentEmpty;
            this.RightPageText = PageContentEmpty;
            this.PageText      = PageContentEmpty;

            if (pageType != ContentPageType.PageType.ContentEntry)
            {
                this.Parent_ContentID = null;
                this.NavOrder         = SiteData.BlogSortOrderNumber;
                this.ShowInSiteMap    = false;
                this.ShowInSiteNav    = false;
            }

            this.ContentCategories = new List <ContentCategory>();
            this.ContentTags       = new List <ContentTag>();
        }
Esempio n. 16
0
        internal BasicContentData(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.SiteID           = c.SiteID;
                this.Root_ContentID   = c.Root_ContentID;
                this.PageActive       = c.PageActive;
                this.Parent_ContentID = c.Parent_ContentID;
                this.FileName         = c.FileName;
                this.TemplateFile     = c.TemplateFile;
                this.NavOrder         = c.NavOrder;

                this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
                this.CreateDate  = site.ConvertUTCToSiteTime(c.CreateDate);
                this.GoLiveDate  = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate  = site.ConvertUTCToSiteTime(c.RetireDate);
            }
        }
Esempio n. 17
0
 public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType)
 {
     return(50);
 }
Esempio n. 18
0
 public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber, string sortField, string sortDir)
 {
     return(SiteNavHelper.GetSamplerFakeNav(pageSize));
 }
Esempio n. 19
0
 public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageNumber)
 {
     return(SiteNavHelper.GetSamplerFakeNav(10));
 }
Esempio n. 20
0
 internal static IQueryable <vw_carrot_Comment> GetSiteContentCommentsByPostType(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType contentEntry, bool?approved, bool?spam)
 {
     return(from r in ctx.vw_carrot_Comments
            orderby r.CreateDate descending
            where r.SiteID == siteID &&
            (spam == null || r.IsSpam == spam) &&
            (approved == null || r.IsApproved == approved) &&
            r.ContentTypeID == ContentPageType.GetIDByType(contentEntry)
            select r);
 }
Esempio n. 21
0
 internal static IQueryable <vw_carrot_Content> GetAllByTypeList(CarrotCMSDataContext ctx, Guid siteID, bool bActiveOnly, ContentPageType.PageType entryType)
 {
     return(from ct in ctx.vw_carrot_Contents
            orderby ct.NavOrder, ct.NavMenuText
            where ct.SiteID == siteID &&
            ct.IsLatestVersion == true &&
            (ct.PageActive == true || bActiveOnly == false) &&
            (ct.GoLiveDate < DateTime.UtcNow || bActiveOnly == false) &&
            (ct.RetireDate > DateTime.UtcNow || bActiveOnly == false) &&
            ct.IsLatestVersion == true &&
            ct.ContentTypeID == ContentPageType.GetIDByType(entryType)
            select ct);
 }
Esempio n. 22
0
        internal static IQueryable <vw_carrot_Content> GetContentByStatusAndDateRange(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType pageType,
                                                                                      DateTime dateBegin, DateTime dateEnd, bool?bActive, bool?bSiteMap, bool?bSiteNav, bool?bBlock)
        {
            Guid gContent      = ContentPageType.GetIDByType(ContentPageType.PageType.ContentEntry);
            Guid gBlog         = ContentPageType.GetIDByType(ContentPageType.PageType.BlogEntry);
            Guid contentTypeID = ContentPageType.GetIDByType(pageType);

            return(from ct in ctx.vw_carrot_Contents
                   orderby ct.ContentTypeValue, ct.NavMenuText
                   where ct.SiteID == siteID &&
                   ct.IsLatestVersion == true &&
                   ct.GoLiveDate >= dateBegin &&
                   ct.GoLiveDate <= dateEnd &&
                   (ct.ContentTypeID == contentTypeID || pageType == ContentPageType.PageType.Unknown) &&
                   (ct.PageActive == Convert.ToBoolean(bActive) || bActive == null) &&
                   (ct.BlockIndex == Convert.ToBoolean(bBlock) || bBlock == null) &&
                   ((ct.ShowInSiteMap == Convert.ToBoolean(bSiteMap) && ct.ContentTypeID == gContent) || bSiteMap == null) &&
                   ((ct.ShowInSiteNav == Convert.ToBoolean(bSiteNav) && ct.ContentTypeID == gContent) || bSiteNav == null)
                   select ct);
        }
Esempio n. 23
0
        public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly)
        {
            int iCount = CannedQueries.GetAllByTypeList(db, siteID, bActiveOnly, entryType).Count();

            return(iCount);
        }
Esempio n. 24
0
        public void FetchData()
        {
            base.ReadPageNbr();

            string sPagePath = SiteData.CurrentScriptName;

            if (String.IsNullOrEmpty(this.OrderBy))
            {
                this.InitOrderByDescending(x => x.GoLiveDate);
            }

            List <SiteNav> lstContents = new List <SiteNav>();

            string sSearchTerm = String.Empty;

            ContentPageType.PageType viewContentType = ContentPageType.PageType.BlogEntry;

            if (this.IgnoreSitePath)
            {
                sPagePath = String.Format("/siteid-{0}", SiteData.CurrentSiteID);
            }

            if (SiteData.IsWebView)
            {
                if (SiteData.CurrentSite.IsSiteSearchPath && !this.IgnoreSitePath)
                {
                    this.ContentType = SummaryContentType.SiteSearch;
                    sSearchTerm      = GetSearchTerm();
                }
            }

            switch (this.ContentType)
            {
            case SummaryContentType.Blog:
            case SummaryContentType.ContentPage:
            case SummaryContentType.SiteSearch:
                this.InitOrderByDescending(x => x.GoLiveDate);
                break;
            }

            SortParm sp       = this.ParseSort();
            string   sSortFld = sp.SortField;
            string   sSortDir = sp.SortDirection;

            if (this.PageNumber <= 0)
            {
                this.PageNumber = 1;
            }

            using (ISiteNavHelper navHelper = SiteNavFactory.GetSiteNavHelper()) {
                if (SiteData.IsWebView)
                {
                    switch (this.ContentType)
                    {
                    case SummaryContentType.Blog:
                        viewContentType   = ContentPageType.PageType.BlogEntry;
                        this.TotalRecords = navHelper.GetFilteredContentPagedCount(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor);
                        lstContents       = navHelper.GetFilteredContentPagedList(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir);
                        break;

                    case SummaryContentType.ChildContentPage:
                        viewContentType   = ContentPageType.PageType.ContentEntry;
                        this.TotalRecords = navHelper.GetChildNavigationCount(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor);
                        lstContents       = navHelper.GetLatestChildContentPagedList(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir);
                        break;

                    case SummaryContentType.ContentPage:
                        viewContentType   = ContentPageType.PageType.ContentEntry;
                        this.TotalRecords = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor);
                        lstContents       = navHelper.GetLatestContentPagedList(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir);
                        break;

                    case SummaryContentType.SpecifiedCategories:
                        viewContentType   = ContentPageType.PageType.BlogEntry;
                        this.TotalRecords = navHelper.GetFilteredContentByIDPagedCount(SiteData.CurrentSite, null, SelectedCategorySlugs, !SecurityData.IsAuthEditor);
                        lstContents       = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, null, SelectedCategorySlugs, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir);
                        break;

                    case SummaryContentType.SiteSearch:
                        this.TotalRecords = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor);
                        lstContents       = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir);
                        break;
                    }
                }
                else
                {
                    viewContentType   = ContentPageType.PageType.ContentEntry;
                    this.TotalRecords = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, false);
                    lstContents       = navHelper.GetLatestContentPagedList(Guid.NewGuid(), viewContentType, false, this.PageSize, this.PageNumberZeroIndex, sSortFld, sSortDir);
                }
            }

            lstContents.ToList().ForEach(q => CMSConfigHelper.IdentifyLinkAsInactive(q));

            this.DataSource = lstContents;
        }
Esempio n. 25
0
        public static ContentPage CreateWPContentPage(WordPressSite wps, WordPressPost c, SiteData site)
        {
            ContentPage cont = null;

            ContentPageType.PageType contType = ContentPageType.PageType.Unknown;
            switch (c.PostType)
            {
            case WordPressPost.WPPostType.BlogPost:
                contType = ContentPageType.PageType.BlogEntry;
                break;

            case WordPressPost.WPPostType.Page:
                contType = ContentPageType.PageType.ContentEntry;
                break;
            }

            if (c != null)
            {
                cont           = new ContentPage(site.SiteID, contType);
                cont.ContentID = Guid.NewGuid();

                cont.CreateUserId = SecurityData.CurrentUserGuid;
                cont.EditUserId   = SecurityData.CurrentUserGuid;

                if (!String.IsNullOrEmpty(c.PostAuthor))
                {
                    WordPressUser wpu = wps.Authors.Where(x => x.Login.ToLower() == c.PostAuthor.ToLower()).FirstOrDefault();

                    if (wpu != null && wpu.ImportUserID != Guid.Empty)
                    {
                        ApplicationUser usr = SecurityData.GetUserByID(wpu.ImportUserID.ToString());
                        if (usr != null)
                        {
                            cont.CreateUserId = wpu.ImportUserID;
                            cont.EditUserId   = wpu.ImportUserID;
                        }
                    }
                }

                cont.Root_ContentID   = c.ImportRootID;
                cont.FileName         = c.ImportFileName.Replace("//", "/");
                cont.PageSlug         = null;
                cont.NavOrder         = c.PostOrder;
                cont.Parent_ContentID = null;

                cont.CreateDate  = site.ConvertUTCToSiteTime(c.PostDateUTC);
                cont.PageActive  = c.IsPublished;
                cont.ContentType = ContentPageType.PageType.Unknown;

                if (c.PostType == WordPressPost.WPPostType.BlogPost)
                {
                    cont.ContentType      = ContentPageType.PageType.BlogEntry;
                    cont.PageSlug         = c.ImportFileSlug.Replace("//", "/");
                    cont.NavOrder         = SiteData.BlogSortOrderNumber;
                    cont.Parent_ContentID = null;
                }
                if (c.PostType == WordPressPost.WPPostType.Page)
                {
                    cont.ContentType = ContentPageType.PageType.ContentEntry;
                }

                if (cont.ContentType == ContentPageType.PageType.ContentEntry)
                {
                    cont.ShowInSiteMap = true;
                    cont.ShowInSiteNav = true;
                }
                else
                {
                    cont.ShowInSiteMap = false;
                    cont.ShowInSiteNav = false;
                }

                cont.IsLatestVersion = true;

                cont.IsLatestVersion = true;
                cont.TitleBar        = c.PostTitle;
                cont.NavMenuText     = c.PostTitle;
                cont.PageHead        = c.PostTitle;
                cont.PageText        = c.PostContent;
                cont.LeftPageText    = String.Empty;
                cont.RightPageText   = String.Empty;

                cont.MetaDescription = String.Empty;
                cont.MetaKeyword     = String.Empty;

                cont.ContentCategories = new List <ContentCategory>();
                cont.ContentTags       = new List <ContentTag>();

                List <ContentTag>      lstTags       = site.GetTagList();
                List <ContentCategory> lstCategories = site.GetCategoryList();

                cont.ContentCategories = (from l in lstCategories
                                          join o in c.Categories on l.CategorySlug.ToLower() equals o.ToLower()
                                          select l).Distinct().ToList();

                cont.ContentTags = (from l in lstTags
                                    join o in c.Tags on l.TagSlug.ToLower() equals o.ToLower()
                                    select l).Distinct().ToList();
            }

            return(cont);
        }
Esempio n. 26
0
        public override void FetchData()
        {
            HttpContext context   = HttpContext.Current;
            string      sPagePath = SiteData.CurrentScriptName;

            if (String.IsNullOrEmpty(this.OrderBy))
            {
                this.OrderBy = "GoLiveDate  desc";
            }

            List <SiteNav> lstContents = new List <SiteNav>();

            string sSearchTerm = String.Empty;

            ContentPageType.PageType viewContentType = ContentPageType.PageType.BlogEntry;

            if (this.IgnoreSitePath)
            {
                sPagePath = String.Format("/siteid-{0}.aspx", SiteData.CurrentSiteID);
            }

            if (context != null)
            {
                if (SiteData.CurrentSite.IsSiteSearchPath && !this.IgnoreSitePath)
                {
                    this.ContentType = SummaryContentType.SiteSearch;
                    sSearchTerm      = GetSearchTerm();
                }
            }

            switch (this.ContentType)
            {
            case SummaryContentType.Blog:
            case SummaryContentType.ContentPage:
            case SummaryContentType.SiteSearch:
                this.OrderBy = "GoLiveDate  desc";
                break;
            }

            SortParm sp       = this.ParseSort();
            string   sSortFld = sp.SortField;
            string   sSortDir = sp.SortDirection;

            int iPageNbr = this.PageNumberZeroIndex;

            if (context != null)
            {
                switch (this.ContentType)
                {
                case SummaryContentType.Blog:
                    viewContentType = ContentPageType.PageType.BlogEntry;
                    TotalRecords    = navHelper.GetFilteredContentPagedCount(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor);
                    lstContents     = navHelper.GetFilteredContentPagedList(SiteData.CurrentSite, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir);
                    break;

                case SummaryContentType.ChildContentPage:
                    viewContentType = ContentPageType.PageType.ContentEntry;
                    TotalRecords    = navHelper.GetChildNavigationCount(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor);
                    lstContents     = navHelper.GetLatestChildContentPagedList(SiteData.CurrentSiteID, sPagePath, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir);
                    break;

                case SummaryContentType.ContentPage:
                    viewContentType = ContentPageType.PageType.ContentEntry;
                    TotalRecords    = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor);
                    lstContents     = navHelper.GetLatestContentPagedList(SiteData.CurrentSiteID, viewContentType, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir);
                    break;

                case SummaryContentType.SpecifiedCategories:
                    viewContentType = ContentPageType.PageType.BlogEntry;
                    TotalRecords    = navHelper.GetFilteredContentByIDPagedCount(SiteData.CurrentSite, SelectedCategories, SelectedCategorySlugs, !SecurityData.IsAuthEditor);
                    lstContents     = navHelper.GetFilteredContentByIDPagedList(SiteData.CurrentSite, SelectedCategories, SelectedCategorySlugs, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir);
                    break;

                case SummaryContentType.SiteSearch:
                    TotalRecords = navHelper.GetSiteSearchCount(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor);
                    lstContents  = navHelper.GetLatestContentSearchList(SiteData.CurrentSiteID, sSearchTerm, !SecurityData.IsAuthEditor, this.PageSize, iPageNbr, sSortFld, sSortDir);
                    break;
                }
            }
            else
            {
                viewContentType = ContentPageType.PageType.ContentEntry;
                TotalRecords    = navHelper.GetSitePageCount(SiteData.CurrentSiteID, viewContentType, false);
                lstContents     = navHelper.GetLatestContentPagedList(Guid.NewGuid(), viewContentType, false, this.PageSize, iPageNbr, sSortFld, sSortDir);
            }

            lstContents.ToList().ForEach(q => IdentifyLinkAsInactive(q));

            this.DataSource = lstContents;

            PrevNext();
        }
Esempio n. 27
0
        public static List <PostComment> GetCommentsBySitePageNumber(Guid siteID, int iPageNbr, int iPageSize, string SortBy, ContentPageType.PageType pageType, bool?approved, bool?spam)
        {
            int startRec = iPageNbr * iPageSize;

            using (CarrotCMSDataContext _db = CarrotCMSDataContext.Create()) {
                IQueryable <vw_carrot_Comment> lstComments = (from c in CannedQueries.GetSiteContentCommentsByPostType(_db, siteID, pageType, approved, spam)
                                                              select c);

                return(PaginateComments(lstComments, iPageNbr, iPageSize, SortBy).ToList());
            }
        }
Esempio n. 28
0
 public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType, bool bActiveOnly)
 {
     return(50);
 }
Esempio n. 29
0
        public int GetSitePageCount(Guid siteID, ContentPageType.PageType entryType)
        {
            int iCount = CannedQueries.GetAllByTypeList(db, siteID, false, entryType).Count();

            return(iCount);
        }
Esempio n. 30
0
		internal PostComment(vw_carrot_Comment c) {
			if (c != null) {
				this.ContentCommentID = c.ContentCommentID;
				this.Root_ContentID = c.Root_ContentID;
				this.CreateDate = SiteData.CurrentSite.ConvertUTCToSiteTime(c.CreateDate);
				this.CommenterIP = c.CommenterIP;
				this.CommenterName = c.CommenterName;
				this.CommenterEmail = c.CommenterEmail;
				this.CommenterURL = c.CommenterURL;
				this.PostCommentText = c.PostComment;
				this.IsApproved = c.IsApproved;
				this.IsSpam = c.IsSpam;
				this.NavMenuText = c.NavMenuText;
				this.FileName = c.FileName;
				this.ContentType = ContentPageType.GetTypeByID(c.ContentTypeID);
			}
		}
		//protected void Page_Load(object sender, EventArgs e) {
		protected void Page_Init(object sender, EventArgs e) {
			guidContentID = GetGuidIDFromQuery();

			EditorPrefs = UserEditState.cmsUserEditState;
			if (EditorPrefs == null) {
				EditorPrefs = new UserEditState();
				EditorPrefs.Init();
			}

			string sCurrentPage = SiteData.CurrentScriptName;
			string sScrubbedURL = SiteData.AlternateCurrentScriptName;

			if (sScrubbedURL.ToLower() != sCurrentPage.ToLower()) {
				sCurrentPage = sScrubbedURL;
			}

			ContentPage pageContents = new ContentPage();
			if (guidContentID == Guid.Empty) {
				pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage);
			} else {
				pageContents = pageHelper.FindContentByID(SiteData.CurrentSiteID, guidContentID);
			}

			PageType = pageContents.ContentType;
			EditedPageFileName = pageContents.FileName;

			btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPageInfo();";

			if (pageContents.ContentType == ContentPageType.PageType.BlogEntry) {
				btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPostInfo();";
				btnSortChildPages.Visible = false;
			}

			if (cmsHelper.cmsAdminContent != null) {
				EditedPageFileName = cmsHelper.cmsAdminContent.FileName;
			}

			if (cmsHelper.ToolboxPlugins.Any()) {
				GeneralUtilities.BindRepeater(rpTools, cmsHelper.ToolboxPlugins);
			} else {
				rpTools.Visible = false;
			}

			bLocked = pageHelper.IsPageLocked(pageContents.Root_ContentID, SiteData.CurrentSiteID, SecurityData.CurrentUserGuid);

			GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);
			try { GeneralUtilities.SelectListValue(ddlTemplate, cmsHelper.cmsAdminContent.TemplateFile.ToLower()); } catch { }

			if (!bLocked) {
				foreach (Control c in plcIncludes.Controls) {
					this.Page.Header.Controls.Add(c);
				}

				//jquerybasic jquerybasic2 = new jquerybasic();
				//jquerybasic2.SelectedSkin = jquerybasic.jQueryTheme.NotUsed;
				//Page.Header.Controls.AddAt(0, jquerybasic2);

				//BasicControlUtils.InsertjQuery(this.Page);

				BasicControlUtils.InsertjQueryMain(this.Page);
				BasicControlUtils.InsertjQueryUI(this.Page);

				guidContentID = pageContents.Root_ContentID;

				if (cmsHelper.cmsAdminContent == null) {
					pageContents.LoadAttributes();
					cmsHelper.cmsAdminContent = pageContents;
				} else {
					pageContents = cmsHelper.cmsAdminContent;
				}

				bool bRet = pageHelper.RecordPageLock(pageContents.Root_ContentID, SiteData.CurrentSite.SiteID, SecurityData.CurrentUserGuid);

				cmsDivEditing.Visible = false;

				BasicControlUtils.MakeXUACompatibleFirst(this.Page);
			} else {
				pnlCMSEditZone.Visible = false;
				rpTools.Visible = false;
				btnToolboxSave1.Visible = false;
				btnToolboxSave2.Visible = false;
				btnToolboxSave3.Visible = false;
				btnTemplate.Visible = false;
				btnEditCoreInfo.Visible = false;
				cmsDivEditing.Visible = true;

				if (bLocked && pageContents.Heartbeat_UserId != null) {
					MembershipUser usr = SecurityData.GetUserByGuid(pageContents.Heartbeat_UserId.Value);
					EditUserName = usr.UserName;
					litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the page.<br />" +
						" Click <b><a href=\"" + pageContents.FileName + "\">here</a></b> to return to the browse view.<br />";
				}
			}
		}
Esempio n. 32
0
        internal static Dictionary <string, float> GetTemplateCounts(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType pageType)
        {
            Guid contentTypeID = ContentPageType.GetIDByType(pageType);

            return((from ct in ctx.vw_carrot_Contents.Where(c => c.SiteID == siteID && c.ContentTypeID == contentTypeID && c.IsLatestVersion == true)
                    group ct by ct.TemplateFile.ToLower() into grp
                    orderby grp.Count() descending
                    select new KeyValuePair <string, float>(grp.Key.ToLower(), (float)grp.Count()))
                   .ToDictionary(t => t.Key, t => t.Value));
        }
Esempio n. 33
0
 public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageSize, int pageNumber)
 {
     return(GetLatestContentPagedList(siteID, postType, bActiveOnly, pageSize, pageNumber, "", ""));
 }
Esempio n. 34
0
 internal static IQueryable <vw_carrot_Comment> GetSiteContentCommentsByPostType(CarrotCMSDataContext ctx, Guid siteID, ContentPageType.PageType contentEntry)
 {
     return(from r in ctx.vw_carrot_Comments
            orderby r.CreateDate descending
            where r.SiteID == siteID &&
            r.ContentTypeID == ContentPageType.GetIDByType(contentEntry)
            select r);
 }
		public void FetchItem() {
			guidItemID = GetGuidIDFromQuery();
			item = PostComment.GetContentCommentByID(guidItemID);

			pageType = ContentPageType.PageType.Unknown;

			if (item != null) {
				guidRootContentID = item.Root_ContentID;
			}

			if (guidRootContentID != Guid.Empty) {
				ContentPage pageContents = pageHelper.FindContentByID(SiteID, guidRootContentID);
				pageType = pageContents.ContentType;
			}

			ReturnPageQueryString = "";
			if (IsFullSite) {
				ReturnPageQueryString = string.Format("type={0}", pageType);
			} else {
				ReturnPageQueryString = string.Format("id={0}", guidRootContentID);
			}

			ReturnPageURL = string.Format("{0}?{1}", ReturnPage, ReturnPageQueryString);
		}
Esempio n. 36
0
 public List <SiteNav> GetLatestContentPagedList(Guid siteID, ContentPageType.PageType postType, bool bActiveOnly, int pageNumber, string sortField, string sortDir)
 {
     return(GetLatestContentPagedList(siteID, postType, bActiveOnly, 10, pageNumber, sortField, sortDir));
 }
Esempio n. 37
0
        //protected void Page_Load(object sender, EventArgs e) {
        protected void Page_Init(object sender, EventArgs e)
        {
            guidContentID = GetGuidIDFromQuery();

            EditorPrefs = UserEditState.cmsUserEditState;
            if (EditorPrefs == null)
            {
                EditorPrefs = new UserEditState();
                EditorPrefs.Init();
            }

            string sCurrentPage = SiteData.CurrentScriptName;
            string sScrubbedURL = SiteData.AlternateCurrentScriptName;

            if (sScrubbedURL.ToLowerInvariant() != sCurrentPage.ToLowerInvariant())
            {
                sCurrentPage = sScrubbedURL;
            }

            ContentPage pageContents = new ContentPage();

            if (guidContentID == Guid.Empty)
            {
                pageContents = pageHelper.FindByFilename(SiteData.CurrentSiteID, sCurrentPage);
            }
            else
            {
                pageContents = pageHelper.FindContentByID(SiteData.CurrentSiteID, guidContentID);
            }

            PageType           = pageContents.ContentType;
            EditedPageFileName = pageContents.FileName;

            btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPageInfo();";

            if (pageContents.ContentType == ContentPageType.PageType.BlogEntry)
            {
                btnEditCoreInfo.Attributes["onclick"] = "cmsShowEditPostInfo();";
                btnSortChildPages.Visible             = false;
            }

            if (cmsHelper.cmsAdminContent != null)
            {
                EditedPageFileName = cmsHelper.cmsAdminContent.FileName;
            }

            if (cmsHelper.ToolboxPlugins.Any())
            {
                GeneralUtilities.BindRepeater(rpTools, cmsHelper.ToolboxPlugins);
            }
            else
            {
                rpTools.Visible = false;
            }

            bLocked = pageHelper.IsPageLocked(pageContents.Root_ContentID, SiteData.CurrentSiteID, SecurityData.CurrentUserGuid);

            GeneralUtilities.BindList(ddlTemplate, cmsHelper.Templates);
            try { GeneralUtilities.SelectListValue(ddlTemplate, cmsHelper.cmsAdminContent.TemplateFile.ToLowerInvariant()); } catch { }

            if (!bLocked)
            {
                foreach (Control c in plcIncludes.Controls)
                {
                    this.Page.Header.Controls.Add(c);
                }

                //jquerybasic jquerybasic2 = new jquerybasic();
                //jquerybasic2.SelectedSkin = jquerybasic.jQueryTheme.NotUsed;
                //Page.Header.Controls.AddAt(0, jquerybasic2);

                //BasicControlUtils.InsertjQuery(this.Page);

                BasicControlUtils.InsertjQueryMain(this.Page);
                BasicControlUtils.InsertjQueryUI(this.Page);

                guidContentID = pageContents.Root_ContentID;

                if (cmsHelper.cmsAdminContent == null)
                {
                    pageContents.LoadAttributes();
                    cmsHelper.cmsAdminContent = pageContents;
                }
                else
                {
                    pageContents = cmsHelper.cmsAdminContent;
                }

                bool bRet = pageHelper.RecordPageLock(pageContents.Root_ContentID, SiteData.CurrentSite.SiteID, SecurityData.CurrentUserGuid);

                cmsDivEditing.Visible = false;

                BasicControlUtils.MakeXUACompatibleFirst(this.Page);
            }
            else
            {
                pnlCMSEditZone.Visible  = false;
                rpTools.Visible         = false;
                btnToolboxSave1.Visible = false;
                btnToolboxSave2.Visible = false;
                btnToolboxSave3.Visible = false;
                btnTemplate.Visible     = false;
                btnEditCoreInfo.Visible = false;
                cmsDivEditing.Visible   = true;

                if (bLocked && pageContents.Heartbeat_UserId != null)
                {
                    MembershipUser usr = SecurityData.GetUserByGuid(pageContents.Heartbeat_UserId.Value);
                    EditUserName = usr.UserName;
                    litUser.Text = "Read only mode. User '" + usr.UserName + "' is currently editing the page.<br />" +
                                   " Click <b><a href=\"" + pageContents.FileName + "\">here</a></b> to return to the browse view.<br />";
                }
            }
        }